[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 21 May 2014 13:08:13 +0000 (15:08 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 21 May 2014 13:08:13 +0000 (15:08 +0200)
2014-05-21  Robert Dewar  <dewar@adacore.com>

* sem_elab.adb, prj-dect.adb: Minor reformatting.

2014-05-21  Robert Dewar  <dewar@adacore.com>

* erroutc.ads: Minor comment addition.

2014-05-21  Robert Dewar  <dewar@adacore.com>

* errout.ads: Add documentation for use of >*> tag.
* restrict.adb: Make sure we use >*> tag for restriction warnings.

2014-05-21  Gary Dismukes  <dismukes@adacore.com>

* debug.adb: Add case of illegal overriding_indicator for a
protected subprogram body to description of -gnatd.E switch.
* sem_ch6.adb (Verify_Overriding_Indicator): Issue error message
for cases of giving overriding_indicators on protected subprogram
bodies, but change this to a warning if -gnatd.E is enabled. No
longer give a style warning about missing indicators on protected
subprogram bodies.

From-SVN: r210704

gcc/ada/ChangeLog
gcc/ada/debug.adb
gcc/ada/errout.ads
gcc/ada/erroutc.ads
gcc/ada/prj-dect.adb
gcc/ada/restrict.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_elab.adb

index 7729446..d65b3b0 100644 (file)
@@ -1,5 +1,28 @@
 2014-05-21  Robert Dewar  <dewar@adacore.com>
 
+       * sem_elab.adb, prj-dect.adb: Minor reformatting.
+
+2014-05-21  Robert Dewar  <dewar@adacore.com>
+
+       * erroutc.ads: Minor comment addition.
+
+2014-05-21  Robert Dewar  <dewar@adacore.com>
+
+       * errout.ads: Add documentation for use of >*> tag.
+       * restrict.adb: Make sure we use >*> tag for restriction warnings.
+
+2014-05-21  Gary Dismukes  <dismukes@adacore.com>
+
+       * debug.adb: Add case of illegal overriding_indicator for a
+       protected subprogram body to description of -gnatd.E switch.
+       * sem_ch6.adb (Verify_Overriding_Indicator): Issue error message
+       for cases of giving overriding_indicators on protected subprogram
+       bodies, but change this to a warning if -gnatd.E is enabled. No
+       longer give a style warning about missing indicators on protected
+       subprogram bodies.
+
+2014-05-21  Robert Dewar  <dewar@adacore.com>
+
        * prj.ads, sem_ch12.adb, prj.adb, exp_pakd.adb,
        sem_elab.ads: Minor reformatting.
        * erroutc.adb, erroutc.ads (Warning_Specifically_Suppressed): Make Tag
index f2f118b..d5fae27 100644 (file)
@@ -614,6 +614,11 @@ package body Debug is
    --
    --          Errors relating to the new rules about not defining equality
    --          too late so that composition of equality can be assured.
+   --
+   --          Errors relating to overriding indicators on protected subprogram
+   --          bodies (not an Ada 2012 incompatibility, but might cause errors
+   --          for existing programs assuming they were legal because GNAT
+   --          formerly allowed them).
 
    --  d.F  Sets GNATprove_Mode to True. This allows debugging the frontend in
    --       the special mode used by GNATprove.
index 8c561fb..a42d3db 100644 (file)
@@ -312,10 +312,10 @@ package Errout is
    --    Insertion character < (Less Than: conditional warning message)
    --      The character < appearing anywhere in a message is used for a
    --      conditional error message. If Error_Msg_Warn is True, then the
-   --      effect is the same as ? described above, and in particular << and
-   --      <X< have the effect of ?? and ?X? respectively. If Error_Msg_Warn
-   --      is False, then the < << or <X< sequence is ignored and the message
-   --      is treated as a error rather than a warning.
+   --      effect is the same as ? described above, and in particular <<
+   --      <X< and <*< have the effect of ?? ?X? and ?*? respectively. If
+   --      Error_Msg_Warn is False, then the < << or <X< sequence is ignored
+   --      and the message is treated as a error rather than a warning.
 
    --    Insertion character A-Z (Upper case letter: Ada reserved word)
    --      If two or more upper case letters appear in the message, they are
index 96ac676..c638aac 100644 (file)
@@ -564,6 +564,10 @@ package Erroutc is
    --  the corresponding warning string is returned (or the null string if no
    --  Warning argument was present in the pragma). Tag is the error message
    --  tag for the message in question or the null string if there is no tag.
+   --
+   --  Note: we have a null default for Tag to deal with calls from an old
+   --  branch of gnat2why, which does not know about tags in the calls but
+   --  which uses the latest version of erroutc.
 
    function Warning_Treated_As_Error (Msg : String) return Boolean;
    --  Returns True if the warning message Msg matches any of the strings
index dafe882..a4d07d8 100644 (file)
@@ -215,10 +215,9 @@ package body Prj.Dect is
       Name   : constant Name_Id := Name_Of (Current_Package, In_Tree);
    begin
       if (Qualif = Aggregate and then Name /= Snames.Name_Builder)
-        or else
-         (Qualif = Aggregate_Library
-          and then Name /= Snames.Name_Builder
-          and then Name /= Snames.Name_Install)
+        or else (Qualif = Aggregate_Library
+                  and then Name /= Snames.Name_Builder
+                  and then Name /= Snames.Name_Install)
       then
          Error_Msg_Name_1 := Name;
          Error_Msg
index abf294a..78591c1 100644 (file)
@@ -303,7 +303,7 @@ package body Restrict is
          Error_Msg_Node_1 := N;
          Error_Msg_Warn := No_Use_Of_Attribute_Warning (A_Id);
          Error_Msg_N
-           ("<violation of restriction `No_Use_Of_Attribute '='> &`#", N);
+           ("<*<violation of restriction `No_Use_Of_Attribute '='> &`#", N);
       end if;
    end Check_Restriction_No_Use_Of_Attribute;
 
@@ -336,7 +336,7 @@ package body Restrict is
          Error_Msg_Node_1 := Id;
          Error_Msg_Warn := No_Use_Of_Pragma_Warning (P_Id);
          Error_Msg_N
-           ("<violation of restriction `No_Use_Of_Pragma '='> &`#", Id);
+           ("<*<violation of restriction `No_Use_Of_Pragma '='> &`#", Id);
       end if;
    end Check_Restriction_No_Use_Of_Pragma;
 
@@ -645,7 +645,7 @@ package body Restrict is
 
             if No_Dependences.Table (J).Warn then
                Error_Msg
-                 ("??violation of restriction `No_Dependence '='> &`#",
+                 ("?*?violation of restriction `No_Dependence '='> &`#",
                   Sloc (Err));
             else
                Error_Msg
@@ -691,7 +691,7 @@ package body Restrict is
          Error_Msg_Node_1 := Id;
          Error_Msg_Warn := No_Specification_Of_Aspect_Warning (A_Id);
          Error_Msg_N
-           ("<violation of restriction `No_Specification_Of_Aspect '='> &`#",
+           ("<*<violation of restriction `No_Specification_Of_Aspect '='> &`#",
             Id);
       end if;
    end Check_Restriction_No_Specification_Of_Aspect;
index 0c2bdf4..a3364b8 100644 (file)
@@ -2782,6 +2782,16 @@ package body Sem_Ch6 is
             elsif not Present (Overridden_Operation (Spec_Id)) then
                Error_Msg_NE
                  ("subprogram& is not overriding", Body_Spec, Spec_Id);
+
+            --  Overriding indicators aren't allowed for protected subprogram
+            --  bodies (see the Confirmation in Ada Comment AC95-00213). Change
+            --  this to a warning if -gnatd.E is enabled.
+
+            elsif Ekind (Scope (Spec_Id)) = E_Protected_Type then
+               Error_Msg_Warn := Error_To_Warning;
+               Error_Msg_N
+                 ("<overriding indicator not allowed for protected "
+                  & "subprogram body", Body_Spec);
             end if;
 
          elsif Must_Not_Override (Body_Spec) then
@@ -2797,20 +2807,37 @@ package body Sem_Ch6 is
                  ("subprogram & overrides predefined operator ",
                     Body_Spec, Spec_Id);
 
-            --  If this is not a primitive operation or protected subprogram,
-            --  then the overriding indicator is altogether illegal.
+            --  Overriding indicators aren't allowed for protected subprogram
+            --  bodies (see the Confirmation in Ada Comment AC95-00213). Change
+            --  this to a warning if -gnatd.E is enabled.
+
+            elsif Ekind (Scope (Spec_Id)) = E_Protected_Type then
+               Error_Msg_Warn := Error_To_Warning;
 
-            elsif not Is_Primitive (Spec_Id)
-              and then Ekind (Scope (Spec_Id)) /= E_Protected_Type
-            then
+               Error_Msg_N
+                 ("<overriding indicator not allowed " &
+                  "for protected subprogram body",
+                  Body_Spec);
+
+            --  If this is not a primitive operation, then the overriding
+            --  indicator is altogether illegal.
+
+            elsif not Is_Primitive (Spec_Id) then
                Error_Msg_N
                  ("overriding indicator only allowed " &
                   "if subprogram is primitive",
                   Body_Spec);
             end if;
 
+         --  If checking the style rule and the operation overrides, then
+         --  issue a warning about a missing overriding_indicator. Protected
+         --  subprogram bodies are excluded from this style checking, since
+         --  they aren't primitives (even though their declarations can
+         --  override) and aren't allowed to have an overriding_indicator.
+
          elsif Style_Check
            and then Present (Overridden_Operation (Spec_Id))
+           and then Ekind (Scope (Spec_Id)) /= E_Protected_Type
          then
             pragma Assert (Unit_Declaration_Node (Body_Id) = N);
             Style.Missing_Overriding (N, Body_Id);
index 8b8c58a..19c6aa2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1997-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 1997-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -2503,7 +2503,7 @@ package body Sem_Elab is
          Collect_Tasks (Declarations (N));
       end if;
 
-      --  We only perform detailed checks in all tasks are library level
+      --  We only perform detailed checks in all tasks that are library level
       --  entities. If the master is a subprogram or task, activation will
       --  depend on the activation of the master itself.