+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.
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));
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,
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;
@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),
@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})
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;
-- 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;
-----------------------------
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.
-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
"-gnatwk " &
"NOCONSTANT_VARIABLES " &
"-gnatwK " &
+ "STANDARD_REDEFINITION " &
+ "-gnatw.k " &
+ "NOSTANDARD_REDEFINITION " &
+ "-gnatw.K " &
"ELABORATION " &
"-gnatwl " &
"NOELABORATION " &
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;
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
+ -- a 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;
-- 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;