Commit f02b8bb8 by Robert Dewar Committed by Arnaud Charlet

re PR ada/18434 (Ada: cannot build gnattools on Tru64 UNIX V5.1B)

2005-11-14  Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>

	PR ada/18434

	* types.ads: Include All_Checks in Suppress_Array

	* checks.adb (Check_Needed): Remove kludge for a/=b rewritten as
	not(a=b), since we no longer do this rewriting, and hence it is not
	needed.
	(Elaboration_Checks_Suppressed): Add special casing to
	deal with different cases of static and dynamic elaboration checks (all
	checks does not count in the first case, but does in the second).
	(Expr_Known_Valid): Do not assume that the result of any arbitrary
	function call is valid, since this is not the case.
	(Ensure_Valid): Do not apply validity check to a real literal
	in a universal or fixed context

	* exp_ch4.adb (Expand_N_Op_Ne): Don't expand a/=b to not(a=b) for
	elementary types using the operator in standard. It is cleaner not to
	modify the programmers intent, especially in the case of floating-point.
	(Rewrite_Comparison): Fix handling of /= (this was always wrong, but
	it did not matter because we always rewrote a/=b to not(a=b).
	(Expand_Allocator_Expression): For an allocator expression whose nominal
	subtype is an unconstrained packed type, convert the expression to its
	actual constrained subtype.
	Implement warning for <= or >= where < or > not possible
	Fix to Vax_Float tests (too early in many routines, causing premature
	Vax_Float expansions.

	* sem_prag.adb (Analyze_Pragma, case Obsolescent): Allow this pragma
	to be used with packages and generic packages as well as with
	subprograms.
	(Suppress): Set All_Checks, but not Elaboration_Check, for case
	of pragma Suppress (All_Checks)
	(Analyze_Pragma, case Warnings): Implement first argument allowed to be
	a string literal for precise control over warnings.
	Avoid raise of pragma in case of unrecognized pragma and just return
	instead.

	* sem_prag.ads: Minor reformatting

	* switch-c.adb (Scan_Front_End_Switches): Replace "raise Bad_Switch;"
	with call to new procedure Bad_Switch. Call Scan_Pos with new parameter
	Switch. Do not handle any exception.
	Include -gnatwx as part of -gnatg (warn on redundant parens)
	Allow optional = after -gnatm
	(Scan_Front_End_Switches): The -gnatp switch sets All_Checks, but no
	longer sets Elaboration_Checks.
	Code to set warning mode moved to Sem_Warn
	so that it can be shared by pragma processing.

	* s-mastop-tru64.adb (Pop_Frame): Remove redundant parentheses in if
	statement.

	* s-taprop-solaris.adb: 
	Change some <= to =, to avoid new warning

	* a-exexda.adb, prj-proc.adb: 
	Fix obvious typo (Num_Tracebacks compared <= 0 instead of < 0)
	Fix obvious typo (Total_Errors_Detected <= 0 should be = 0)

From-SVN: r106950
parent 3e1fd98f
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -386,7 +386,7 @@ package body Exception_Data is ...@@ -386,7 +386,7 @@ package body Exception_Data is
Ptr : in out Natural) Ptr : in out Natural)
is is
begin begin
if X.Num_Tracebacks <= 0 then if X.Num_Tracebacks = 0 then
return; return;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -2481,13 +2481,11 @@ package body Checks is ...@@ -2481,13 +2481,11 @@ package body Checks is
exit when N = Right_Opnd (P) exit when N = Right_Opnd (P)
and then Nkind (Left_Opnd (P)) = N_Op_Eq; and then Nkind (Left_Opnd (P)) = N_Op_Eq;
-- And/And then case, left operand must be inequality test. Note that -- And/And then case, left operand must be inequality test
-- at this stage, the expander will have changed a/=b to not (a=b).
elsif K = N_Op_And or else K = N_And_Then then elsif K = N_Op_And or else K = N_And_Then then
exit when N = Right_Opnd (P) exit when N = Right_Opnd (P)
and then Nkind (Left_Opnd (P)) = N_Op_Not and then Nkind (Left_Opnd (P)) = N_Op_Ne;
and then Nkind (Right_Opnd (Left_Opnd (P))) = N_Op_Eq;
end if; end if;
N := P; N := P;
...@@ -3259,15 +3257,32 @@ package body Checks is ...@@ -3259,15 +3257,32 @@ package body Checks is
function Elaboration_Checks_Suppressed (E : Entity_Id) return Boolean is function Elaboration_Checks_Suppressed (E : Entity_Id) return Boolean is
begin begin
-- The complication in this routine is that if we are in the dynamic
-- model of elaboration, we also check All_Checks, since All_Checks
-- does not set Elaboration_Check explicitly.
if Present (E) then if Present (E) then
if Kill_Elaboration_Checks (E) then if Kill_Elaboration_Checks (E) then
return True; return True;
elsif Checks_May_Be_Suppressed (E) then elsif Checks_May_Be_Suppressed (E) then
return Is_Check_Suppressed (E, Elaboration_Check); if Is_Check_Suppressed (E, Elaboration_Check) then
return True;
elsif Dynamic_Elaboration_Checks then
return Is_Check_Suppressed (E, All_Checks);
else
return False;
end if;
end if; end if;
end if; end if;
return Scope_Suppress (Elaboration_Check); if Scope_Suppress (Elaboration_Check) then
return True;
elsif Dynamic_Elaboration_Checks then
return Scope_Suppress (All_Checks);
else
return False;
end if;
end Elaboration_Checks_Suppressed; end Elaboration_Checks_Suppressed;
--------------------------- ---------------------------
...@@ -3690,6 +3705,15 @@ package body Checks is ...@@ -3690,6 +3705,15 @@ package body Checks is
then then
return; return;
-- No check on a univeral real constant. The context will eventually
-- convert it to a machine number for some target type, or report an
-- illegality.
elsif Nkind (Expr) = N_Real_Literal
and then Etype (Expr) = Universal_Real
then
return;
-- An annoying special case. If this is an out parameter of a scalar -- An annoying special case. If this is an out parameter of a scalar
-- type, then the value is not going to be accessed, therefore it is -- type, then the value is not going to be accessed, therefore it is
-- inappropriate to do any validity check at the call site. -- inappropriate to do any validity check at the call site.
...@@ -3845,11 +3869,10 @@ package body Checks is ...@@ -3845,11 +3869,10 @@ package body Checks is
then then
return Expr_Known_Valid (Expression (Expr)); return Expr_Known_Valid (Expression (Expr));
-- The result of any function call or operator is always considered -- The result of any operator is always considered valid, since we
-- valid, since we assume the necessary checks are done by the call. -- assume the necessary checks are done by the operator. For operators
-- For operators on floating-point operations, we must also check -- on floating-point operations, we must also check when the operation
-- when the operation is the right-hand side of an assignment, or -- is the right-hand side of an assignment, or is an actual in a call.
-- is an actual in a call.
elsif elsif
Nkind (Expr) in N_Binary_Op or else Nkind (Expr) in N_Unary_Op Nkind (Expr) in N_Binary_Op or else Nkind (Expr) in N_Unary_Op
...@@ -3866,9 +3889,6 @@ package body Checks is ...@@ -3866,9 +3889,6 @@ package body Checks is
return True; return True;
end if; end if;
elsif Nkind (Expr) = N_Function_Call then
return True;
-- For all other cases, we do not know the expression is valid -- For all other cases, we do not know the expression is valid
else else
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1129,7 +1129,7 @@ package body Prj.Proc is ...@@ -1129,7 +1129,7 @@ package body Prj.Proc is
end loop; end loop;
end if; end if;
Success := Total_Errors_Detected <= 0; Success := Total_Errors_Detected = 0;
end Process; end Process;
------------------------------- -------------------------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- B o d y -- -- B o d y --
-- (Version for Alpha/Dec Unix) -- -- (Version for Alpha/Dec Unix) --
-- -- -- --
-- Copyright (C) 1999-2005 Ada Core Technologies, Inc. -- -- Copyright (C) 1999-2005, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -143,7 +143,7 @@ package body System.Machine_State_Operations is ...@@ -143,7 +143,7 @@ package body System.Machine_State_Operations is
Prf : constant System.Address := exc_lookup_function (Get_Code_Loc (M)); Prf : constant System.Address := exc_lookup_function (Get_Code_Loc (M));
begin begin
if (Prf = System.Null_Address) then if Prf = System.Null_Address then
c_set_code_loc (M, 0); c_set_code_loc (M, 0);
else else
exc_virtual_unwind (Prf, M); exc_virtual_unwind (Prf, M);
......
...@@ -1382,7 +1382,7 @@ package body System.Task_Primitives.Operations is ...@@ -1382,7 +1382,7 @@ package body System.Task_Primitives.Operations is
begin begin
-- Check that caller is abort-deferred -- Check that caller is abort-deferred
if Self_ID.Deferral_Level <= 0 then if Self_ID.Deferral_Level = 0 then
return False; return False;
end if; end if;
...@@ -1419,7 +1419,7 @@ package body System.Task_Primitives.Operations is ...@@ -1419,7 +1419,7 @@ package body System.Task_Primitives.Operations is
-- Check that caller is abort-deferred -- Check that caller is abort-deferred
if Self_ID.Deferral_Level <= 0 then if Self_ID.Deferral_Level = 0 then
return False; return False;
end if; end if;
...@@ -1498,7 +1498,7 @@ package body System.Task_Primitives.Operations is ...@@ -1498,7 +1498,7 @@ package body System.Task_Primitives.Operations is
begin begin
-- Check that caller is abort-deferred -- Check that caller is abort-deferred
if Self_ID.Deferral_Level <= 0 then if Self_ID.Deferral_Level = 0 then
return False; return False;
end if; end if;
...@@ -1617,7 +1617,7 @@ package body System.Task_Primitives.Operations is ...@@ -1617,7 +1617,7 @@ package body System.Task_Primitives.Operations is
-- Check that caller is abort-deferred -- Check that caller is abort-deferred
if Self_ID.Deferral_Level <= 0 then if Self_ID.Deferral_Level = 0 then
return False; return False;
end if; end if;
...@@ -1646,7 +1646,7 @@ package body System.Task_Primitives.Operations is ...@@ -1646,7 +1646,7 @@ package body System.Task_Primitives.Operations is
begin begin
-- Check that caller is abort-deferred -- Check that caller is abort-deferred
if Self_ID.Deferral_Level <= 0 then if Self_ID.Deferral_Level = 0 then
return False; return False;
end if; end if;
...@@ -1833,7 +1833,7 @@ package body System.Task_Primitives.Operations is ...@@ -1833,7 +1833,7 @@ package body System.Task_Primitives.Operations is
-- Check that caller is abort-deferred -- Check that caller is abort-deferred
if Self_ID.Deferral_Level <= 0 then if Self_ID.Deferral_Level = 0 then
return False; return False;
end if; end if;
......
...@@ -64,6 +64,7 @@ with Sem_Res; use Sem_Res; ...@@ -64,6 +64,7 @@ with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type; with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util; with Sem_Util; use Sem_Util;
with Sem_VFpt; use Sem_VFpt; with Sem_VFpt; use Sem_VFpt;
with Sem_Warn; use Sem_Warn;
with Stand; use Stand; with Stand; use Stand;
with Sinfo; use Sinfo; with Sinfo; use Sinfo;
with Sinfo.CN; use Sinfo.CN; with Sinfo.CN; use Sinfo.CN;
...@@ -236,8 +237,9 @@ package body Sem_Prag is ...@@ -236,8 +237,9 @@ package body Sem_Prag is
Pragma_Exit : exception; Pragma_Exit : exception;
-- This exception is used to exit pragma processing completely. It -- This exception is used to exit pragma processing completely. It
-- is used when an error is detected, and in other situations where -- is used when an error is detected, and no further processing is
-- it is known that no further processing is required. -- required. It is also used if an earlier error has left the tree
-- in a state where the pragma should not be processed.
Arg_Count : Nat; Arg_Count : Nat;
-- Number of pragma argument associations -- Number of pragma argument associations
...@@ -1336,10 +1338,7 @@ package body Sem_Prag is ...@@ -1336,10 +1338,7 @@ package body Sem_Prag is
then then
Unit_Name := Defining_Entity (Unit_Node); Unit_Name := Defining_Entity (Unit_Node);
elsif Unit_Kind = N_Function_Instantiation elsif Unit_Kind in N_Generic_Instantiation then
or else Unit_Kind = N_Package_Instantiation
or else Unit_Kind = N_Procedure_Instantiation
then
Unit_Name := Defining_Entity (Unit_Node); Unit_Name := Defining_Entity (Unit_Node);
else else
...@@ -3784,9 +3783,21 @@ package body Sem_Prag is ...@@ -3784,9 +3783,21 @@ package body Sem_Prag is
-- suppress check for any check id value. -- suppress check for any check id value.
if C = All_Checks then if C = All_Checks then
-- For All_Checks, we set all specific checks with the
-- exception of Elaboration_Check, which is handled specially
-- because of not wanting All_Checks to have the effect of
-- deactivating static elaboration order processing.
for J in Scope_Suppress'Range loop for J in Scope_Suppress'Range loop
if J /= Elaboration_Check then
Scope_Suppress (J) := Suppress_Case; Scope_Suppress (J) := Suppress_Case;
end if;
end loop; end loop;
-- If not All_Checks, just set appropriate entry. Note that we
-- will set Elaboration_Check if this is explicitly specified.
else else
Scope_Suppress (C) := Suppress_Case; Scope_Suppress (C) := Suppress_Case;
end if; end if;
...@@ -4259,7 +4270,7 @@ package body Sem_Prag is ...@@ -4259,7 +4270,7 @@ package body Sem_Prag is
if Warn_On_Unrecognized_Pragma then if Warn_On_Unrecognized_Pragma then
Error_Pragma ("unrecognized pragma%!?"); Error_Pragma ("unrecognized pragma%!?");
else else
raise Pragma_Exit; return;
end if; end if;
else else
Prag_Id := Get_Pragma_Id (Chars (N)); Prag_Id := Get_Pragma_Id (Chars (N));
...@@ -5991,7 +6002,7 @@ package body Sem_Prag is ...@@ -5991,7 +6002,7 @@ package body Sem_Prag is
Present (Source_Location) Present (Source_Location)
then then
Error_Pragma Error_Pragma
("parameter profile and source location can not " & ("parameter profile and source location cannot " &
"be used together in pragma%"); "be used together in pragma%");
end if; end if;
...@@ -8141,6 +8152,28 @@ package body Sem_Prag is ...@@ -8141,6 +8152,28 @@ package body Sem_Prag is
S : String_Id; S : String_Id;
Active : Boolean := True; Active : Boolean := True;
procedure Check_Obsolete_Subprogram;
-- Checks if Subp is a subprogram declaration node, and if so
-- replaces Subp by the defining entity of the subprogram. If not,
-- issues an error message
------------------------------
-- Check_Obsolete_Subprogram--
------------------------------
procedure Check_Obsolete_Subprogram is
begin
if Nkind (Subp) /= N_Subprogram_Declaration then
Error_Pragma
("pragma% misplaced, must immediately " &
"follow subprogram/package declaration");
else
Subp := Defining_Entity (Subp);
end if;
end Check_Obsolete_Subprogram;
-- Start of processing for pragma Obsolescent
begin begin
GNAT_Pragma; GNAT_Pragma;
Check_At_Most_N_Arguments (2); Check_At_Most_N_Arguments (2);
...@@ -8153,6 +8186,7 @@ package body Sem_Prag is ...@@ -8153,6 +8186,7 @@ package body Sem_Prag is
if Present (Prev (N)) then if Present (Prev (N)) then
Subp := Prev (N); Subp := Prev (N);
Check_Obsolete_Subprogram;
-- Second possibility, stand alone subprogram declaration with the -- Second possibility, stand alone subprogram declaration with the
-- pragma immediately following the declaration. -- pragma immediately following the declaration.
...@@ -8161,25 +8195,22 @@ package body Sem_Prag is ...@@ -8161,25 +8195,22 @@ package body Sem_Prag is
and then Nkind (Parent (N)) = N_Compilation_Unit_Aux and then Nkind (Parent (N)) = N_Compilation_Unit_Aux
then then
Subp := Unit (Parent (Parent (N))); Subp := Unit (Parent (Parent (N)));
Check_Obsolete_Subprogram;
-- Any other possibility is a misplacement -- Only other possibility is library unit placement for package
else else
Subp := Empty; Subp := Find_Lib_Unit_Name;
end if;
-- Check correct placement
if Nkind (Subp) /= N_Subprogram_Declaration then if Ekind (Subp) /= E_Package
Error_Pragma and then Ekind (Subp) /= E_Generic_Package
("pragma% misplaced, must immediately " & then
"follow subprogram spec"); Check_Obsolete_Subprogram;
end if;
end if; end if;
-- If OK placement, acquire arguments -- If OK placement, acquire arguments
Subp := Defining_Entity (Subp);
if Arg_Count >= 1 then if Arg_Count >= 1 then
-- Deal with static string argument -- Deal with static string argument
...@@ -9907,8 +9938,7 @@ package body Sem_Prag is ...@@ -9907,8 +9938,7 @@ package body Sem_Prag is
("pragma% requires separate spec and must come before body"); ("pragma% requires separate spec and must come before body");
elsif Rep_Item_Too_Early (E, N) elsif Rep_Item_Too_Early (E, N)
or else or else Rep_Item_Too_Late (E, N)
Rep_Item_Too_Late (E, N)
then then
raise Pragma_Exit; raise Pragma_Exit;
...@@ -10346,16 +10376,58 @@ package body Sem_Prag is ...@@ -10346,16 +10376,58 @@ package body Sem_Prag is
-------------- --------------
-- pragma Warnings (On | Off, [LOCAL_NAME]) -- pragma Warnings (On | Off, [LOCAL_NAME])
-- pragma Warnings (static_string_EXPRESSION);
when Pragma_Warnings => Warnings : begin when Pragma_Warnings => Warnings : begin
GNAT_Pragma; GNAT_Pragma;
Check_At_Least_N_Arguments (1); Check_At_Least_N_Arguments (1);
Check_At_Most_N_Arguments (2);
Check_No_Identifiers; Check_No_Identifiers;
-- One argument case was processed by parser in Par.Prag -- One argument case
if Arg_Count /= 1 then if Arg_Count = 1 then
declare
Argx : constant Node_Id := Get_Pragma_Arg (Arg1);
begin
-- On/Off one argument case was processed by parser
if Nkind (Argx) = N_Identifier
and then
(Chars (Argx) = Name_On
or else
Chars (Argx) = Name_Off)
then
null;
else
Check_Arg_Is_Static_Expression (Arg1, Standard_String);
declare
Lit : constant Node_Id := Expr_Value_S (Argx);
Str : constant String_Id := Strval (Lit);
C : Char_Code;
begin
for J in 1 .. String_Length (Str) loop
C := Get_String_Char (Str, J);
if In_Character_Range (C)
and then Set_Warning_Switch (Get_Character (C))
then
null;
else
Error_Pragma_Arg
("invalid warning switch character", Arg1);
end if;
end loop;
end;
end if;
end;
-- Two argument case
elsif Arg_Count /= 1 then
Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off); Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off);
Check_Arg_Count (2); Check_Arg_Count (2);
...@@ -10390,8 +10462,8 @@ package body Sem_Prag is ...@@ -10390,8 +10462,8 @@ package body Sem_Prag is
return; return;
else else
loop loop
Set_Warnings_Off (E, Set_Warnings_Off
(Chars (Expression (Arg1)) = Name_Off)); (E, (Chars (Expression (Arg1)) = Name_Off));
if Is_Enumeration_Type (E) then if Is_Enumeration_Type (E) then
declare declare
...@@ -10410,6 +10482,10 @@ package body Sem_Prag is ...@@ -10410,6 +10482,10 @@ package body Sem_Prag is
end loop; end loop;
end if; end if;
end; end;
-- More than two arguments
else
Check_At_Most_N_Arguments (2);
end if; end if;
end Warnings; end Warnings;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -28,62 +28,62 @@ ...@@ -28,62 +28,62 @@
-- (logically this processing belongs in chapter 4) -- (logically this processing belongs in chapter 4)
with Types; use Types; with Types; use Types;
package Sem_Prag is package Sem_Prag is
procedure Analyze_Pragma (N : Node_Id); procedure Analyze_Pragma (N : Node_Id);
-- Analyze procedure for pragma reference node N -- Analyze procedure for pragma reference node N
function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean; function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean;
-- N is a pragma appearing in a configuration pragma file. Most -- N is a pragma appearing in a configuration pragma file. Most such
-- such pragmas are analyzed when the file is read, before parsing -- pragmas are analyzed when the file is read, before parsing and analyzing
-- and analyzing the main unit. However, the analysis of certain -- the main unit. However, the analysis of certain pragmas results in
-- pragmas results in adding information to the compiled main unit, -- adding information to the compiled main unit, and this cannot be done
-- and this cannot be done till the main unit is processed. Such -- till the main unit is processed. Such pragmas return True from this
-- pragmas return True from this function and in Frontend pragmas -- function and in Frontend pragmas where Delay_Config_Pragma_Analyze is
-- where Delay_Config_Pragma_Analyze is True have their analysis -- True have their analysis delayed until after the main program is parsed
-- delayed until after the main program is parsed and analyzed. -- and analyzed.
function Is_Non_Significant_Pragma_Reference (N : Node_Id) return Boolean; function Is_Non_Significant_Pragma_Reference (N : Node_Id) return Boolean;
-- The node N is a node for an entity and the issue is whether the -- The node N is a node for an entity and the issue is whether the
-- occurrence is a reference for the purposes of giving warnings -- occurrence is a reference for the purposes of giving warnings about
-- about unreferenced variables. This function returns True if the -- unreferenced variables. This function returns True if the reference is
-- reference is not a reference from this point of view (e.g. the -- not a reference from this point of view (e.g. the occurrence in a pragma
-- occurrence in a pragma Pack) and False if it is a real reference -- Pack) and False if it is a real reference (e.g. the occcurrence in a
-- (e.g. the occcurrence in a pragma Export); -- pragma Export);
function Is_Pragma_String_Literal (Par : Node_Id) return Boolean; function Is_Pragma_String_Literal (Par : Node_Id) return Boolean;
-- Given an N_Pragma_Argument_Association node, Par, which has the form -- Given an N_Pragma_Argument_Association node, Par, which has the form of
-- of an operator symbol, determines whether or not it should be treated -- an operator symbol, determines whether or not it should be treated as an
-- as an string literal. This is called by Sem_Ch6.Analyze_Operator_Symbol. -- string literal. This is called by Sem_Ch6.Analyze_Operator_Symbol. If
-- If True is returned, the argument is converted to a string literal. If -- True is returned, the argument is converted to a string literal. If
-- False is returned, then the argument is treated as an entity reference -- False is returned, then the argument is treated as an entity reference
-- to the operator. -- to the operator.
function Is_Config_Static_String (Arg : Node_Id) return Boolean; function Is_Config_Static_String (Arg : Node_Id) return Boolean;
-- This is called for a configuration pragma that requires either a -- This is called for a configuration pragma that requires either string
-- string literal or a concatenation of string literals. We cannot -- literal or a concatenation of string literals. We cannot use normal
-- use normal static string processing because it is too early in -- static string processing because it is too early in the case of the
-- the case of the pragma appearing in a configuration pragmas file. -- pragma appearing in a configuration pragmas file. If Arg is of an
-- If Arg is of an appropriate form, then this call obtains the string -- appropriate form, then this call obtains the string (doing any necessary
-- (doing any necessary concatenations) and places it in Name_Buffer, -- concatenations) and places it in Name_Buffer, setting Name_Len to its
-- setting Name_Len to its length, and then returns True. If it is -- length, and then returns True. If it is not of the correct form, then an
-- not of the correct form, then an appropriate error message is -- appropriate error message is posted, and False is returned.
-- posted, and False is returned.
procedure Process_Compilation_Unit_Pragmas (N : Node_Id); procedure Process_Compilation_Unit_Pragmas (N : Node_Id);
-- Called at the start of processing compilation unit N to deal with -- Called at the start of processing compilation unit N to deal with any
-- any special issues regarding pragmas. In particular, we have to -- special issues regarding pragmas. In particular, we have to deal with
-- deal with Suppress_All at this stage, since it appears after the -- Suppress_All at this stage, since it appears after the unit instead of
-- unit instead of before. -- before.
procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id); procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id);
-- This routine is used to set an encoded interface name. The node -- This routine is used to set an encoded interface name. The node S is an
-- S is an N_String_Literal node for the external name to be set, and -- N_String_Literal node for the external name to be set, and E is an
-- E is an entity whose Interface_Name field is to be set. In the -- entity whose Interface_Name field is to be set. In the normal case where
-- normal case where S contains a name that is a valid C identifier, -- S contains a name that is a valid C identifier, then S is simply set as
-- then S is simply set as the value of the Interface_Name. Otherwise -- the value of the Interface_Name. Otherwise it is encoded. See the body
-- it is encoded. See the body for details of the encoding. This -- for details of the encoding. This encoding is only done on VMS systems,
-- encoding is only done on VMS systems, since it seems pretty silly, -- since it seems pretty silly, but is needed to pass some dubious tests in
-- but is needed to pass some dubious tests in the test suite. -- the test suite.
end Sem_Prag; end Sem_Prag;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -311,14 +311,14 @@ package Types is ...@@ -311,14 +311,14 @@ package Types is
-- is in practice infinite and there is no need to check the range. -- is in practice infinite and there is no need to check the range.
Ureal_Low_Bound : constant := 500_000_000; Ureal_Low_Bound : constant := 500_000_000;
-- Low bound for Ureal values. -- Low bound for Ureal values
Ureal_High_Bound : constant := 599_999_999; Ureal_High_Bound : constant := 599_999_999;
-- Maximum number of Ureal values stored is 100_000_000 which is in -- Maximum number of Ureal values stored is 100_000_000 which is in
-- practice infinite so that no check is required. -- practice infinite so that no check is required.
Uint_Low_Bound : constant := 600_000_000; Uint_Low_Bound : constant := 600_000_000;
-- Low bound for Uint values. -- Low bound for Uint values
Uint_Table_Start : constant := 2_000_000_000; Uint_Table_Start : constant := 2_000_000_000;
-- Location where table entries for universal integers start (see -- Location where table entries for universal integers start (see
...@@ -479,7 +479,7 @@ package Types is ...@@ -479,7 +479,7 @@ package Types is
-- are not valid. -- are not valid.
First_Elist_Id : constant Elist_Id := No_Elist + 1; First_Elist_Id : constant Elist_Id := No_Elist + 1;
-- Subscript of first allocated Elist header. -- Subscript of first allocated Elist header
-- Element Id values are used to identify individual elements of an -- Element Id values are used to identify individual elements of an
-- element list (see package Elists for further details). -- element list (see package Elists for further details).
...@@ -696,12 +696,19 @@ package Types is ...@@ -696,12 +696,19 @@ package Types is
Tag_Check, Tag_Check,
All_Checks); All_Checks);
-- The following record contains an entry for each recognized check name -- The following array contains an entry for each recognized check name
-- for pragma Suppress. It is used to represent current settings of scope -- for pragma Suppress. It is used to represent current settings of scope
-- based suppress actions from pragma Suppress or command line settings. -- based suppress actions from pragma Suppress or command line settings.
type Suppress_Array is -- Note: when Suppress_Array (All_Checks) is True, then generally all other
array (Check_Id range Access_Check .. Tag_Check) of Boolean; -- specific check entries are set True, except for the Elaboration_Check
-- entry which is set only if an explicit Suppress for this check is given.
-- The reason for this non-uniformity is that we do not want All_Checks to
-- suppress elaboration checking when using the static elaboration model.
-- We recognize only an explicit suppress of Elaboration_Check as a signal
-- that the static elaboration checking should skip a compile time check.
type Suppress_Array is array (Check_Id) of Boolean;
pragma Pack (Suppress_Array); pragma Pack (Suppress_Array);
-- To add a new check type to GNAT, the following steps are required: -- To add a new check type to GNAT, the following steps are required:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment