Commit 59e5fbe0 by Robert Dewar Committed by Arnaud Charlet

re PR ada/10671 (improve error message for named notation used in pragma)

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

	PR ada/10671

	* sem_prag.adb: Implement pragma Persistent_BSS
	Remove obsolete pragma Persistent_Data, Persistent_Object
	Set Ada_Version_Explicit, for implementation of AI-362
	Test Ada_Version_Explicit for Preelaborate_05 and Pure_05
	Add processing for pragma Pure_05 and Preelaborate_05
	Add processing for Assertion_Policy pragma
	Add pragma identifiers for Assert
	(Analyze_Pragma, case Assert): Check number of arguments
	(Process_Inline): Additional guard against an illegal program, where the
	argument of the pragma is undefined, and warnings on redundant
	constructs are enabled.
	(Analyze_Pragma, case Obsolescent): Allow an optional second argument
	Ada_05 to this pragma, specifying that the pragma is only active in
	Ada_05 mode.
	(Check_Arg_Order): New procedure
	Add appropriate calls to this procedure throughout
	Also throughout, check entity name before doing any other checks

	* snames.h snames.ads, snames.adb: Add pragma Persistent_BSS
	Remove obsolete pragma Persistent_Data, Persistent_Object
	Add entries for pragma Pure_05 and Preelaborate_05
	Add entries for Assertion_Policy pragma and associated names
	Add some names for pragma argument processing

	* tbuild.ads, tbuild.adb: (Make_Linker_Section_Pragma): New function

From-SVN: r101060
parent 6eaf4095
...@@ -169,6 +169,7 @@ package body Snames is ...@@ -169,6 +169,7 @@ package body Snames is
"ada_83#" & "ada_83#" &
"ada_95#" & "ada_95#" &
"ada_05#" & "ada_05#" &
"assertion_policy#" &
"c_pass_by_copy#" & "c_pass_by_copy#" &
"compile_time_warning#" & "compile_time_warning#" &
"component_alignment#" & "component_alignment#" &
...@@ -191,8 +192,7 @@ package body Snames is ...@@ -191,8 +192,7 @@ package body Snames is
"no_strict_aliasing#" & "no_strict_aliasing#" &
"normalize_scalars#" & "normalize_scalars#" &
"polling#" & "polling#" &
"persistent_data#" & "persistent_bss#" &
"persistent_object#" &
"profile#" & "profile#" &
"profile_warnings#" & "profile_warnings#" &
"propagate_exceptions#" & "propagate_exceptions#" &
...@@ -277,9 +277,11 @@ package body Snames is ...@@ -277,9 +277,11 @@ package body Snames is
"page#" & "page#" &
"passive#" & "passive#" &
"preelaborate#" & "preelaborate#" &
"preelaborate_05#" &
"priority#" & "priority#" &
"psect_object#" & "psect_object#" &
"pure#" & "pure#" &
"pure_05#" &
"pure_function#" & "pure_function#" &
"remote_call_interface#" & "remote_call_interface#" &
"remote_types#" & "remote_types#" &
...@@ -320,9 +322,12 @@ package body Snames is ...@@ -320,9 +322,12 @@ package body Snames is
"default#" & "default#" &
"dll#" & "dll#" &
"win32#" & "win32#" &
"alias#" &
"as_is#" & "as_is#" &
"attribute_name#" &
"body_file_name#" & "body_file_name#" &
"boolean_entry_barriers#" & "boolean_entry_barriers#" &
"check#" &
"casing#" & "casing#" &
"code#" & "code#" &
"component#" & "component#" &
...@@ -333,6 +338,7 @@ package body Snames is ...@@ -333,6 +338,7 @@ package body Snames is
"dot_replacement#" & "dot_replacement#" &
"dynamic#" & "dynamic#" &
"entity#" & "entity#" &
"entry_count#" &
"external_name#" & "external_name#" &
"first_optional_parameter#" & "first_optional_parameter#" &
"form#" & "form#" &
...@@ -341,6 +347,8 @@ package body Snames is ...@@ -341,6 +347,8 @@ package body Snames is
"gnat#" & "gnat#" &
"gpl#" & "gpl#" &
"ieee_float#" & "ieee_float#" &
"ignore#" &
"info#" &
"internal#" & "internal#" &
"link_name#" & "link_name#" &
"lowercase#" & "lowercase#" &
...@@ -348,6 +356,7 @@ package body Snames is ...@@ -348,6 +356,7 @@ package body Snames is
"max_entry_queue_length#" & "max_entry_queue_length#" &
"max_size#" & "max_size#" &
"mechanism#" & "mechanism#" &
"message#" &
"mixedcase#" & "mixedcase#" &
"modified_gpl#" & "modified_gpl#" &
"name#" & "name#" &
...@@ -373,6 +382,7 @@ package body Snames is ...@@ -373,6 +382,7 @@ package body Snames is
"semaphore#" & "semaphore#" &
"simple_barriers#" & "simple_barriers#" &
"spec_file_name#" & "spec_file_name#" &
"state#" &
"static#" & "static#" &
"stack_size#" & "stack_size#" &
"subunit_file_name#" & "subunit_file_name#" &
...@@ -390,6 +400,7 @@ package body Snames is ...@@ -390,6 +400,7 @@ package body Snames is
"user#" & "user#" &
"vax_float#" & "vax_float#" &
"vms#" & "vms#" &
"vtable_ptr#" &
"working_storage#" & "working_storage#" &
"abort_signal#" & "abort_signal#" &
"access#" & "access#" &
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
****************************************************************************/ ****************************************************************************/
/* This is the C file that corresponds to the Ada package specification /* This is the C file that corresponds to the Ada package specification
Snames. It was created manually from the file snames.ads. */ Snames. It was created automatically from the file snames.ads. */
/* Name_Id values */ /* Name_Id values */
...@@ -151,7 +151,6 @@ extern unsigned char Get_Attribute_Id (int); ...@@ -151,7 +151,6 @@ extern unsigned char Get_Attribute_Id (int);
#define Attr_Wide_Width 103 #define Attr_Wide_Width 103
#define Attr_Width 104 #define Attr_Width 104
#define Attr_Word_Size 105 #define Attr_Word_Size 105
#define Attr_Adjacent 106 #define Attr_Adjacent 106
#define Attr_Ceiling 107 #define Attr_Ceiling 107
#define Attr_Copy_Sign 108 #define Attr_Copy_Sign 108
...@@ -173,18 +172,30 @@ extern unsigned char Get_Attribute_Id (int); ...@@ -173,18 +172,30 @@ extern unsigned char Get_Attribute_Id (int);
#define Attr_Wide_Wide_Image 124 #define Attr_Wide_Wide_Image 124
#define Attr_Wide_Value 125 #define Attr_Wide_Value 125
#define Attr_Wide_Wide_Value 126 #define Attr_Wide_Wide_Value 126
#define Attr_Output 127 #define Attr_Output 127
#define Attr_Read 128 #define Attr_Read 128
#define Attr_Write 129 #define Attr_Write 129
#define Attr_Elab_Body 130 #define Attr_Elab_Body 130
#define Attr_Elab_Spec 131 #define Attr_Elab_Spec 131
#define Attr_Storage_Pool 132 #define Attr_Storage_Pool 132
#define Attr_Base 133 #define Attr_Base 133
#define Attr_Class 134 #define Attr_Class 134
/* Define the numeric values for the conventions. */
#define Convention_Ada 0
#define Convention_Intrinsic 1
#define Convention_Entry 2
#define Convention_Protected 3
#define Convention_Assembler 4
#define Convention_C 5
#define Convention_COBOL 6
#define Convention_CPP 7
#define Convention_Fortran 8
#define Convention_Java 9
#define Convention_Stdcall 10
#define Convention_Stubbed 11
/* Define the function to check if a Name_Id value is a valid pragma */ /* Define the function to check if a Name_Id value is a valid pragma */
#define Is_Pragma_Name snames__is_pragma_name #define Is_Pragma_Name snames__is_pragma_name
...@@ -200,35 +211,33 @@ extern unsigned char Get_Pragma_Id (int); ...@@ -200,35 +211,33 @@ extern unsigned char Get_Pragma_Id (int);
/* Define the numeric values for the pragmas. */ /* Define the numeric values for the pragmas. */
/* Configuration pragmas first */
#define Pragma_Ada_83 0 #define Pragma_Ada_83 0
#define Pragma_Ada_95 1 #define Pragma_Ada_95 1
#define Pragma_Ada_05 2 #define Pragma_Ada_05 2
#define Pragma_C_Pass_By_Copy 3 #define Pragma_Assertion_Policy 3
#define Pragma_Compile_Time_Warning 4 #define Pragma_C_Pass_By_Copy 4
#define Pragma_Component_Alignment 5 #define Pragma_Compile_Time_Warning 5
#define Pragma_Convention_Identifier 6 #define Pragma_Component_Alignment 6
#define Pragma_Detect_Blocking 7 #define Pragma_Convention_Identifier 7
#define Pragma_Discard_Names 8 #define Pragma_Detect_Blocking 8
#define Pragma_Elaboration_Checking 9 #define Pragma_Discard_Names 9
#define Pragma_Eliminate 10 #define Pragma_Elaboration_Checks 10
#define Pragma_Explicit_Overriding 11 #define Pragma_Eliminate 11
#define Pragma_Extend_System 12 #define Pragma_Explicit_Overriding 12
#define Pragma_Extensions_Allowed 13 #define Pragma_Extend_System 13
#define Pragma_External_Name_Casing 14 #define Pragma_Extensions_Allowed 14
#define Pragma_Float_Representation 15 #define Pragma_External_Name_Casing 15
#define Pragma_Initialize_Scalars 16 #define Pragma_Float_Representation 16
#define Pragma_Interrupt_State 17 #define Pragma_Initialize_Scalars 17
#define Pragma_License 18 #define Pragma_Interrupt_State 18
#define Pragma_Locking_Policy 19 #define Pragma_License 19
#define Pragma_Long_Float 20 #define Pragma_Locking_Policy 20
#define Pragma_No_Run_Time 21 #define Pragma_Long_Float 21
#define Pragma_No_Strict_Aliasing 22 #define Pragma_No_Run_Time 22
#define Pragma_Normalize_Scalars 23 #define Pragma_No_Strict_Aliasing 23
#define Pragma_Polling 24 #define Pragma_Normalize_Scalars 24
#define Pragma_Persistent_Data 25 #define Pragma_Polling 25
#define Pragma_Persistent_Object 26 #define Pragma_Persistent_BSS 26
#define Pragma_Profile 27 #define Pragma_Profile 27
#define Pragma_Profile_Warnings 28 #define Pragma_Profile_Warnings 28
#define Pragma_Propagate_Exceptions 29 #define Pragma_Propagate_Exceptions 29
...@@ -249,9 +258,6 @@ extern unsigned char Get_Pragma_Id (int); ...@@ -249,9 +258,6 @@ extern unsigned char Get_Pragma_Id (int);
#define Pragma_Use_VADS_Size 44 #define Pragma_Use_VADS_Size 44
#define Pragma_Validity_Checks 45 #define Pragma_Validity_Checks 45
#define Pragma_Warnings 46 #define Pragma_Warnings 46
/* Remaining pragmas */
#define Pragma_Abort_Defer 47 #define Pragma_Abort_Defer 47
#define Pragma_All_Calls_Remote 48 #define Pragma_All_Calls_Remote 48
#define Pragma_Annotate 49 #define Pragma_Annotate 49
...@@ -316,56 +322,40 @@ extern unsigned char Get_Pragma_Id (int); ...@@ -316,56 +322,40 @@ extern unsigned char Get_Pragma_Id (int);
#define Pragma_Page 108 #define Pragma_Page 108
#define Pragma_Passive 109 #define Pragma_Passive 109
#define Pragma_Preelaborate 110 #define Pragma_Preelaborate 110
#define Pragma_Priority 111 #define Pragma_Preelaborate_05 111
#define Pragma_Psect_Object 112 #define Pragma_Priority 112
#define Pragma_Pure 113 #define Pragma_Psect_Object 113
#define Pragma_Pure_Function 114 #define Pragma_Pure 114
#define Pragma_Remote_Call_Interface 115 #define Pragma_Pure_05 115
#define Pragma_Remote_Types 116 #define Pragma_Pure_Function 116
#define Pragma_Share_Generic 117 #define Pragma_Remote_Call_Interface 117
#define Pragma_Shared 118 #define Pragma_Remote_Types 118
#define Pragma_Shared_Passive 119 #define Pragma_Share_Generic 119
#define Pragma_Source_Reference 120 #define Pragma_Shared 120
#define Pragma_Stream_Convert 121 #define Pragma_Shared_Passive 121
#define Pragma_Subtitle 122 #define Pragma_Source_Reference 122
#define Pragma_Suppress_All 123 #define Pragma_Stream_Convert 123
#define Pragma_Suppress_Debug_Info 124 #define Pragma_Subtitle 124
#define Pragma_Suppress_Initialization 125 #define Pragma_Suppress_All 125
#define Pragma_System_Name 126 #define Pragma_Suppress_Debug_Info 126
#define Pragma_Task_Info 127 #define Pragma_Suppress_Initialization 127
#define Pragma_Task_Name 128 #define Pragma_System_Name 128
#define Pragma_Task_Storage 129 #define Pragma_Task_Info 129
#define Pragma_Thread_Body 130 #define Pragma_Task_Name 130
#define Pragma_Time_Slice 131 #define Pragma_Task_Storage 131
#define Pragma_Title 132 #define Pragma_Thread_Body 132
#define Pragma_Unchecked_Union 133 #define Pragma_Time_Slice 133
#define Pragma_Unimplemented_Unit 134 #define Pragma_Title 134
#define Pragma_Unreferenced 135 #define Pragma_Unchecked_Union 135
#define Pragma_Unreserve_All_Interrupts 136 #define Pragma_Unimplemented_Unit 136
#define Pragma_Volatile 137 #define Pragma_Unreferenced 137
#define Pragma_Volatile_Components 138 #define Pragma_Unreserve_All_Interrupts 138
#define Pragma_Weak_External 139 #define Pragma_Volatile 139
#define Pragma_Volatile_Components 140
/* The following are deliberately out of alphabetical order, see Snames */ #define Pragma_Weak_External 141
#define Pragma_AST_Entry 142
#define Pragma_AST_Entry 140 #define Pragma_Interface 143
#define Pragma_Interface 141 #define Pragma_Storage_Size 144
#define Pragma_Storage_Size 142 #define Pragma_Storage_Unit 145
#define Pragma_Storage_Unit 143
/* Define the numeric values for the conventions. */
#define Convention_Ada 0
#define Convention_Intrinsic 1
#define Convention_Entry 2
#define Convention_Protected 3
#define Convention_Assembler 4
#define Convention_C 5
#define Convention_COBOL 6
#define Convention_CPP 7
#define Convention_Fortran 8
#define Convention_Java 9
#define Convention_Stdcall 10
#define Convention_Stubbed 11
/* End of snames.h (C version of Snames package spec) */ /* End of snames.h (C version of Snames package spec) */
...@@ -256,6 +256,37 @@ package body Tbuild is ...@@ -256,6 +256,37 @@ package body Tbuild is
return Make_Integer_Literal (Loc, UI_From_Int (Intval)); return Make_Integer_Literal (Loc, UI_From_Int (Intval));
end Make_Integer_Literal; end Make_Integer_Literal;
--------------------------------
-- Make_Linker_Section_Pragma --
--------------------------------
function Make_Linker_Section_Pragma
(Ent : Entity_Id;
Loc : Source_Ptr;
Sec : String) return Node_Id
is
LS : Node_Id;
begin
LS :=
Make_Pragma
(Loc,
Name_Linker_Section,
New_List
(Make_Pragma_Argument_Association
(Sloc => Loc,
Expression => New_Occurrence_Of (Ent, Loc)),
Make_Pragma_Argument_Association
(Sloc => Loc,
Expression =>
Make_String_Literal
(Sloc => Loc,
Strval => Sec))));
Set_Has_Gigi_Rep_Item (Ent);
return LS;
end Make_Linker_Section_Pragma;
--------------------------------- ---------------------------------
-- Make_Raise_Constraint_Error -- -- Make_Raise_Constraint_Error --
--------------------------------- ---------------------------------
......
...@@ -118,6 +118,13 @@ package Tbuild is ...@@ -118,6 +118,13 @@ package Tbuild is
pragma Inline (Make_Integer_Literal); pragma Inline (Make_Integer_Literal);
-- A convenient form of Make_Integer_Literal taking Int instead of Uint -- A convenient form of Make_Integer_Literal taking Int instead of Uint
function Make_Linker_Section_Pragma
(Ent : Entity_Id;
Loc : Source_Ptr;
Sec : String) return Node_Id;
-- Construct a Linker_Section pragma for entity Ent, using string Sec as
-- the section name. Loc is the Sloc value to use in building the pragma.
function Make_Raise_Constraint_Error function Make_Raise_Constraint_Error
(Sloc : Source_Ptr; (Sloc : Source_Ptr;
Condition : Node_Id := Empty; Condition : Node_Id := Empty;
......
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