Commit 874a0341 by Robert Dewar Committed by Arnaud Charlet

par-prag.adb (Prag): Add dummy entry for pragma Compile_Time_Error

2007-04-06  Robert Dewar  <dewar@adacore.com>
	    Javier Miranda  <miranda@adacore.com>
	    Bob Duff  <duff@adacore.com>
	    Vincent Celier  <celier@adacore.com>

	* par-prag.adb (Prag): Add dummy entry for pragma Compile_Time_Error
	(Extensions_Allowed): No longer sets Ada_Version
	Entry for pragma Unreferenced_Objects

	* sem_prag.adb (Analyze_Pragma, case Priority): Force with of
	system.tasking if pragma priority used in a procedure
	(Analyze_Pragma, case Warning): Handle dot warning switches
	(Process_Compile_Time_Warning_Or_Error): New procedure
	(Analyze_Pragma): Add processing for Compile_Time_Error
	Add support for extra arguments External_Name and Link_Name.
	Remove code associated with pragmas CPP_Virtual and CPP_Vtable.
	(Process_Import_Or_Interface): Add support for the use of pragma Import
	with tagged types.
	(Extensions_Allowed): No longer affects Ada_Version
	(Analyze_Pragma): Split Is_Abstract flag into Is_Abstract_Subprogram and
	Is_Abstract_Type. Make sure these are called only when appropriate.
	Add processing for pragma Unreferenced_Objects

	* snames.h, snames.ads, snames.adb: Add entry for pragma
	Compile_Time_Error
	Add new standard name Minimum_Binder_Options for new gprmake
	Add new standard names for gprmake: Archive_Suffix,
	Library_Auto_Init_Supported, Library_Major_Minor_Id_Supported,
	Library_Support, Library_Version_Options,
	Shared_Library_Minimum_Options,
	Shared_Library_Prefix, Shared_Library_Suffix, Symbolic_Link_Supported.
	Change Name_Call to Name_uCall so that it cannot clash with a legal
	subprogram name.
	Add new standard names Mapping_Spec_Suffix and Mapping_Body_Suffix
	Append C_Plus_Plus to convention identifiers as synonym for CPP
	Add new standard names Stack and Builder_Switches
	Add new standard names: Compiler_Minimum_Options, Global_Config_File,
	Library_Builder, Local_Config_File, Objects_Path, Objects_Path_File,
	Run_Path_Option, Toolchain_Version.
	Entry for pragma Unreferenced_Objects

	* switch-c.adb (Scan_Front_End_Switches): Store correct -gnateD
	switches, without repetition of "eD". Make sure that last character of
	-gnatep= switch is not taken as -gnat switch character.
	Complete rewrite of circuit for handling saving compilation options
	Occasioned by need to support dot switchs for -gnatw, but cleans up
	things in general.
	-gnatX does not affect Ada_Version
	Include -gnatyA in -gnatg style switches

	* sem_warn.ads, sem_warn.adb (Output_Unreferenced_Messages): Exclude
	warnings on return objects.
	(Warn_On_Useless_Assignment): Exclude warnings on return objects
	(Set_Dot_Warning_Switch): New procedure
	(Check_References): Add missing case of test for
	Has_Pragma_Unreferenced_Objects
	(Output_Unreferenced_Messages): Implement effect of new pragma
	Unreferenced_Objects, remove special casing of limited controlled
	variables.

From-SVN: r123588
parent 6c929a2e
......@@ -376,14 +376,10 @@ begin
if Chars (Expression (Arg1)) = Name_On then
Extensions_Allowed := True;
Ada_Version := Ada_Version_Type'Last;
else
Extensions_Allowed := False;
Ada_Version := Ada_Version_Type'Min (Ada_Version, Ada_95);
end if;
Ada_Version_Explicit := Ada_Version;
----------------
-- List (2.8) --
----------------
......@@ -1058,6 +1054,7 @@ begin
Pragma_Atomic |
Pragma_Atomic_Components |
Pragma_Attach_Handler |
Pragma_Compile_Time_Error |
Pragma_Compile_Time_Warning |
Pragma_Convention_Identifier |
Pragma_CPP_Class |
......@@ -1179,6 +1176,7 @@ begin
Pragma_Unimplemented_Unit |
Pragma_Universal_Data |
Pragma_Unreferenced |
Pragma_Unreferenced_Objects |
Pragma_Unreserve_All_Interrupts |
Pragma_Unsuppress |
Pragma_Use_VADS_Size |
......
......@@ -392,6 +392,7 @@ package body Sem_Warn is
-- or if it is a parameter, to the corresponding spec.
if Has_Pragma_Unreferenced (E1)
or else Has_Pragma_Unreferenced_Objects (Etype (E1))
or else (Is_Formal (E1)
and then Present (Spec_Entity (E1))
and then
......@@ -1641,6 +1642,7 @@ package body Sem_Warn is
then
if Warn_On_Modified_Unread
and then not Is_Imported (E)
and then not Is_Return_Object (E)
-- Suppress message for aliased or renamed variables,
-- since there may be other entities that read the
......@@ -1658,20 +1660,12 @@ package body Sem_Warn is
-- Normal case of neither assigned nor read
else
-- We suppress the message for limited controlled types,
-- to catch the common design pattern (known as RAII, or
-- Resource Acquisition Is Initialization) which uses
-- such types solely for their initialization and
-- finalization semantics.
if Is_Controlled (Etype (E))
and then Is_Limited_Type (Etype (E))
then
null;
-- We suppress the message for types for which a valid
-- pragma Unreferenced_Objects has been given, otherwise
-- we go ahead and give the message.
-- Normal case where we want to give message
if not Has_Pragma_Unreferenced_Objects (Etype (E)) then
else
-- Distinguish renamed case in message
if Present (Renamed_Object (E))
......@@ -1740,6 +1734,26 @@ package body Sem_Warn is
end loop;
end Output_Unreferenced_Messages;
----------------------------
-- Set_Dot_Warning_Switch --
----------------------------
function Set_Dot_Warning_Switch (C : Character) return Boolean is
begin
case C is
when 'x' =>
Warn_On_Non_Local_Exception := True;
when 'X' =>
Warn_On_Non_Local_Exception := False;
when others =>
return False;
end case;
return True;
end Set_Dot_Warning_Switch;
------------------------
-- Set_Warning_Switch --
------------------------
......@@ -1761,6 +1775,7 @@ package body Sem_Warn is
Warn_On_Export_Import := True;
Warn_On_Modified_Unread := True;
Warn_On_No_Value_Assigned := True;
Warn_On_Non_Local_Exception := True;
Warn_On_Obsolescent_Feature := True;
Warn_On_Questionable_Missing_Parens := True;
Warn_On_Redundant_Constructs := True;
......@@ -1784,8 +1799,9 @@ package body Sem_Warn is
Warn_On_Hiding := False;
Warn_On_Modified_Unread := False;
Warn_On_No_Value_Assigned := False;
Warn_On_Non_Local_Exception := False;
Warn_On_Obsolescent_Feature := False;
Warn_On_Questionable_Missing_Parens := True;
Warn_On_Questionable_Missing_Parens := False;
Warn_On_Redundant_Constructs := False;
Warn_On_Unchecked_Conversion := False;
Warn_On_Unrecognized_Pragma := False;
......@@ -2409,11 +2425,12 @@ package body Sem_Warn is
-- Start of processing for Warn_On_Useless_Assignment
begin
-- Check if this is a case we want to warn on, a variable with
-- the last assignment field set, with warnings enabled, and
-- which is not imported or exported.
-- Check if this is a case we want to warn on, a variable with the
-- last assignment field set, with warnings enabled, and which is
-- not imported or exported.
if Ekind (Ent) = E_Variable
and then not Is_Return_Object (Ent)
and then Present (Last_Assignment (Ent))
and then not Warnings_Off (Ent)
and then not Has_Pragma_Unreferenced (Ent)
......
......@@ -37,9 +37,16 @@ package Sem_Warn is
--------------------
function Set_Warning_Switch (C : Character) return Boolean;
-- This function sets the warning switch or switches corresponding to
-- the given character. It is used for processing a -gnatw switch on the
-- command line, or a string literal in pragma Warnings.
-- This function sets the warning switch or switches corresponding to the
-- given character. It is used to process a -gnatw switch on the command
-- line, or a character in a string literal in pragma Warnings. Returns
-- True for valid warning character C, False for invalid character.
function Set_Dot_Warning_Switch (C : Character) return Boolean;
-- This function sets the warning switch or switches corresponding to the
-- given character preceded by a dot. Used to process a -gnatw. switch on
-- the command line or .C in a string literal in pragma Warnings. Returns
-- True for valid warning character C, False for invalid character.
------------------------------------------
-- Routines to Handle Unused References --
......
......@@ -139,7 +139,7 @@ package body Snames is
"partition#" &
"partition_interface#" &
"ras#" &
"call#" &
"_call#" &
"rci_name#" &
"receiver#" &
"result#" &
......@@ -178,6 +178,7 @@ package body Snames is
"ada_2005#" &
"assertion_policy#" &
"c_pass_by_copy#" &
"compile_time_error#" &
"compile_time_warning#" &
"component_alignment#" &
"convention_identifier#" &
......@@ -317,6 +318,7 @@ package body Snames is
"unchecked_union#" &
"unimplemented_unit#" &
"unreferenced#" &
"unreferenced_objects#" &
"unreserve_all_interrupts#" &
"volatile#" &
"volatile_components#" &
......@@ -333,6 +335,7 @@ package body Snames is
"asm#" &
"assembly#" &
"default#" &
"c_plus_plus#" &
"dll#" &
"win32#" &
"as_is#" &
......@@ -664,13 +667,16 @@ package body Snames is
"ada_roots#" &
"archive_builder#" &
"archive_indexer#" &
"archive_suffix#" &
"binder#" &
"binder_driver#" &
"body_suffix#" &
"builder#" &
"builder_switches#" &
"compiler#" &
"compiler_driver#" &
"compiler_kind#" &
"compiler_minimum_options#" &
"compiler_pic_option#" &
"compute_dependency#" &
"config_body_file_name#" &
......@@ -695,6 +701,7 @@ package body Snames is
"finder#" &
"global_compiler_switches#" &
"global_configuration_pragmas#" &
"global_config_file#" &
"gnatls#" &
"gnatstub#" &
"implementation#" &
......@@ -707,32 +714,47 @@ package body Snames is
"language_processing#" &
"languages#" &
"library_ali_dir#" &
"library_dir#" &
"library_auto_init#" &
"library_auto_init_supported#" &
"library_builder#" &
"library_dir#" &
"library_gcc#" &
"library_interface#" &
"library_kind#" &
"library_name#" &
"library_major_minor_id_supported#" &
"library_options#" &
"library_reference_symbol_file#" &
"library_src_dir#" &
"library_support#" &
"library_symbol_file#" &
"library_symbol_policy#" &
"library_version#" &
"library_version_options#" &
"linker#" &
"linker_executable_option#" &
"linker_lib_dir_option#" &
"linker_lib_name_option#" &
"local_config_file#" &
"local_configuration_pragmas#" &
"locally_removed_files#" &
"mapping_file_switches#" &
"mapping_spec_suffix#" &
"mapping_body_suffix#" &
"metrics#" &
"minimum_binder_options#" &
"naming#" &
"objects_path#" &
"objects_path_file#" &
"object_dir#" &
"pretty_printer#" &
"project#" &
"roots#" &
"run_path_option#" &
"runtime_project#" &
"shared_library_minimum_options#" &
"shared_library_prefix#" &
"shared_library_suffix#" &
"separate_suffix#" &
"source_dirs#" &
"source_files#" &
......@@ -742,7 +764,10 @@ package body Snames is
"specification#" &
"specification_exceptions#" &
"specification_suffix#" &
"stack#" &
"switches#" &
"symbolic_link_supported#" &
"toolchain_version#" &
"unaligned_valid#" &
"interface#" &
"overriding#" &
......@@ -976,14 +1001,16 @@ package body Snames is
Convention_Identifiers.Init;
Convention_Identifiers.Append ((Name_Asm, Convention_Assembler));
Convention_Identifiers.Append ((Name_Assembly, Convention_Assembler));
Convention_Identifiers.Append ((Name_Asm, Convention_Assembler));
Convention_Identifiers.Append ((Name_Assembly, Convention_Assembler));
Convention_Identifiers.Append ((Name_Default, Convention_C));
Convention_Identifiers.Append ((Name_External, Convention_C));
Convention_Identifiers.Append ((Name_Default, Convention_C));
Convention_Identifiers.Append ((Name_External, Convention_C));
Convention_Identifiers.Append ((Name_C_Plus_Plus, Convention_CPP));
Convention_Identifiers.Append ((Name_DLL, Convention_Stdcall));
Convention_Identifiers.Append ((Name_Win32, Convention_Stdcall));
Convention_Identifiers.Append ((Name_DLL, Convention_Stdcall));
Convention_Identifiers.Append ((Name_Win32, Convention_Stdcall));
end Initialize;
-----------------------
......
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