[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 29 Oct 2012 11:03:27 +0000 (12:03 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 29 Oct 2012 11:03:27 +0000 (12:03 +0100)
2012-10-29  Robert Dewar  <dewar@adacore.com>

* xr_tabls.adb, xr_tabls.ads, exp_ch9.adb, snames.adb-tmpl,
snames.ads-tmpl, exp_ch3.adb: Minor reformatting.

2012-10-29  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb: Call Build_Subprogrm_Instance_Renamings only when
generating code.

2012-10-29  Robert Dewar  <dewar@adacore.com>

* gnat_ugn.texi: Add documentation for -gnatw.k/-gnatw.K.
* ug_words: Add entries for -gnatw.k/.K for [NO]STANDARD_REDEFINITION.
* vms_data.ads: Add entries for [NO]STANDARD_REDEFINITION.

From-SVN: r192929

gcc/ada/ChangeLog
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch9.adb
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch6.adb
gcc/ada/snames.adb-tmpl
gcc/ada/snames.ads-tmpl
gcc/ada/ug_words
gcc/ada/vms_data.ads
gcc/ada/xr_tabls.adb
gcc/ada/xr_tabls.ads

index f6550b6..0793113 100644 (file)
@@ -1,3 +1,19 @@
+2012-10-29  Robert Dewar  <dewar@adacore.com>
+
+       * xr_tabls.adb, xr_tabls.ads, exp_ch9.adb, snames.adb-tmpl,
+       snames.ads-tmpl, exp_ch3.adb: Minor reformatting.
+
+2012-10-29  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb: Call Build_Subprogrm_Instance_Renamings only when
+       generating code.
+
+2012-10-29  Robert Dewar  <dewar@adacore.com>
+
+       * gnat_ugn.texi: Add documentation for -gnatw.k/-gnatw.K.
+       * ug_words: Add entries for -gnatw.k/.K for [NO]STANDARD_REDEFINITION.
+       * vms_data.ads: Add entries for [NO]STANDARD_REDEFINITION.
+
 2012-10-29  Tristan Gingold  <gingold@adacore.com>
 
        * exp_ch9.adb, s-tarest.ads, exp_ch3.adb: Update comments.
index 83ae4e4..0e703da 100644 (file)
@@ -1538,7 +1538,7 @@ package body Exp_Ch3 is
          end if;
 
          --  Add _Chain (not done in the restricted profile because not used,
-         --  see comment of Create_Restricted_Task in s-tarest.ads).
+         --  see comment for Create_Restricted_Task in s-tarest.ads).
 
          if not Restricted_Profile then
             Append_To (Args, Make_Identifier (Loc, Name_uChain));
@@ -7809,7 +7809,7 @@ package body Exp_Ch3 is
          if not Restricted_Profile then
 
             --  No _Chain for the restricted profile because not used, see
-            --  comment of Create_Restricted_Task in s-tarest.ads.
+            --  comment for Create_Restricted_Task in s-tarest.ads.
 
             Append_To (Formals,
               Make_Parameter_Specification (Loc,
index f103e92..8ce3870 100644 (file)
@@ -912,7 +912,7 @@ package body Exp_Ch9 is
 
    begin
       --  Activation chain is never used in restricted profile, see comment
-      --  of Create_Restricted_Task in s-tarest.ads.
+      --  for Create_Restricted_Task in s-tarest.ads.
 
       if Restricted_Profile then
          return;
index b94f035..1a38806 100644 (file)
@@ -5159,6 +5159,7 @@ switch are
 @option{-gnatwh} (hiding),
 @option{-gnatw.h} (holes (gaps) in record layouts)
 @option{-gnatw.i} (overlapping actuals),
+@option{-gnatw.k} (redefinition of names in standard),
 @option{-gnatwl} (elaboration warnings),
 @option{-gnatw.l} (inherited aspects),
 @option{-gnatw.o} (warn on values set by out parameters ignored),
@@ -5469,6 +5470,24 @@ This warning can also be turned on using @option{-gnatwa}.
 @cindex @option{-gnatwK} (@command{gcc})
 This switch disables warnings on variables that could be declared constants.
 
+@item -gnatw.k
+@emph{Activate warnings on redefinition of names in standard.}
+@cindex @option{-gnatw.k} (@command{gcc})
+This switch activates warnings for declarations that declare a name that
+is defined in package Standard. Such declarations can be confusing,
+especially since the names in package Standard continue to be directly
+visible, meaning that use visibiliy on such redeclared names does not
+work as expected. Names of discriminants and components in records are
+not included in this check.
+This warning is not part of the warnings activated by @option{-gnatwa}.
+It must be explicitly activated.
+
+@item -gnatw.K
+@emph{Suppress warnings on variables that could be constants.}
+@cindex @option{-gnatwK} (@command{gcc})
+This switch activates warnings for declarations that declare a name that
+is defined in package Standard.
+
 @item -gnatwl
 @emph{Activate warnings for elaboration pragmas.}
 @cindex @option{-gnatwl} (@command{gcc})
index ffebc9b..37dc5be 100644 (file)
@@ -2726,10 +2726,14 @@ package body Sem_Ch6 is
             Last_Real_Spec_Entity := Last_Entity (Spec_Id);
 
             --  Within an instance, add local renaming declarations so that
-            --  gdb can retrieve the values of actuals more easily.
+            --  gdb can retrieve the values of actuals more easily. This is
+            --  only relevant if generating code (and indeed we definitely
+            --  do not want these definitions -gnatc mode, because that would
+            --  confuse ASIS).
 
             if Is_Generic_Instance (Spec_Id)
               and then Is_Wrapper_Package (Current_Scope)
+              and then Expander_Active
             then
                Build_Subprogram_Instance_Renamings (N, Current_Scope);
             end if;
index e314d99..9255395 100644 (file)
@@ -423,11 +423,12 @@ package body Snames is
    -- Is_Partition_Elaboration_Policy --
    -------------------------------------
 
-   function Is_Partition_Elaboration_Policy_Name (N : Name_Id)
-      return Boolean is
+   function Is_Partition_Elaboration_Policy_Name
+     (N : Name_Id) return Boolean
+   is
    begin
-      return N in First_Partition_Elaboration_Policy_Name
-           ..  Last_Partition_Elaboration_Policy_Name;
+      return N in First_Partition_Elaboration_Policy_Name ..
+                  Last_Partition_Elaboration_Policy_Name;
    end Is_Partition_Elaboration_Policy_Name;
 
    -----------------------------
index c187600..7987c8a 100644 (file)
@@ -1915,7 +1915,8 @@ package Snames is
    function Is_Locking_Policy_Name (N : Name_Id) return Boolean;
    --  Test to see if the name N is the name of a recognized locking policy
 
-   function Is_Partition_Elaboration_Policy_Name (N : Name_Id) return Boolean;
+   function Is_Partition_Elaboration_Policy_Name
+     (N : Name_Id) return Boolean;
    --  Test to see if the name N is the name of a recognized partition
    --  elaboration policy.
 
index a3ca962..b1b45c4 100644 (file)
@@ -170,6 +170,8 @@ gcc -c          ^ GNAT COMPILE
 -gnatw.P        ^ /WARNINGS=NO_PARAMETER_ORDER
 -gnatw.h        ^ /WARNINGS=OVERRIDING_SIZE
 -gnatw.H        ^ /WARNINGS=NOOVERRIDING_SIZE
+-gnatw.k        ^ /WARNINGS=STANDARD_REDEFINITION
+-gnatw.K        ^ /WARNINGS=NOSTANDARD_REDEFINITION
 -gnatwq         ^ /WARNINGS=MISSING_PARENS
 -gnatwQ         ^ /WARNINGS=NOMISSING_PARENS
 -gnatwr         ^ /WARNINGS=REDUNDANT
index c33bb8f..8c1c1eb 100644 (file)
@@ -3070,6 +3070,10 @@ package VMS_Data is
                                                "-gnatwk "                  &
                                             "NOCONSTANT_VARIABLES "        &
                                                "-gnatwK "                  &
+                                            "STANDARD_REDEFINITION "       &
+                                               "-gnatw.k "                 &
+                                            "NOSTANDARD_REDEFINITION "     &
+                                               "-gnatw.K "                 &
                                             "ELABORATION "                 &
                                                "-gnatwl "                  &
                                             "NOELABORATION "               &
index 2bc2932..61ac675 100644 (file)
@@ -295,10 +295,10 @@ package body Xr_Tabls is
       then
          New_Decl.Match := Default_Match
            or else Match (File_Ref, Line, Column);
-         New_Decl.Is_Parameter := New_Decl.Is_Parameter or else Is_Param;
+         New_Decl.Is_Parameter := New_Decl.Is_Parameter or Is_Param;
 
       elsif New_Decl /= null then
-         New_Decl.Is_Parameter := New_Decl.Is_Parameter or else Is_Param;
+         New_Decl.Is_Parameter := New_Decl.Is_Parameter or Is_Param;
       end if;
 
       return New_Decl;
@@ -413,22 +413,23 @@ package body Xr_Tabls is
 
          when '=' | '<' | '>' | '^' =>
 
-            --  Create a dummy declaration in the table to report it as a
-            --  parameter.
+            --  Create dummy declaration in table to report it as a parameter
+
             --  In a given ALI file, the declaration of the subprogram comes
             --  before the declaration of the parameter. However, it is
             --  possible that another ALI file has been parsed that also
-            --  references the parameter (for instance a named parameter in a
-            --  call), so we need to check whether there already exists a
+            --  references the parameter (for instance a named parameter in
+            --  call), so we need to check whether there already exists a
             --  declaration for the parameter.
 
-            New_Decl := Add_Declaration
-              (File_Ref  => File_Ref,
-               Symbol    => "",
-               Line      => Line,
-               Column    => Column,
-               Decl_Type => ' ',
-               Is_Parameter => True);
+            New_Decl :=
+              Add_Declaration
+                (File_Ref     => File_Ref,
+                 Symbol       => "",
+                 Line         => Line,
+                 Column       => Column,
+                 Decl_Type    => ' ',
+                 Is_Parameter => True);
 
          when 'e' | 'z' | 't' | 'p' | 'P' | 'k' | 'd' =>
             return;
index 9aa47bc..b328b82 100644 (file)
@@ -88,10 +88,9 @@ package Xr_Tabls is
    --  removed, but the new entity is never inserted. Symbol_Match should be
    --  set to False if the name of the symbol doesn't match the pattern from
    --  the command line. In that case, the entity will not be output by
-   --  gnatfind. If Symbol_Match is True, the entity will only be output if the
-   --  file name itself matches.
-   --  Is_Parameter should be set to True if the entity is known to be a
-   --  subprogram parameter.
+   --  gnatfind. If Symbol_Match is True, the entity will only be output if
+   --  the file name itself matches. Is_Parameter should be set to True if
+   --  the entity is known to be a subprogram parameter.
 
    procedure Add_Parent
      (Declaration : in out Declaration_Reference;