diff options
author | Robert Dewar <dewar@adacore.com> | 2007-04-06 11:25:05 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-04-06 11:25:05 +0200 |
commit | 874a0341c8306d74db689405040a4bc4f550085a (patch) | |
tree | 3b517a2f19b064dd50f9f6fd05484c058f948fc4 /gcc/ada/sem_warn.adb | |
parent | 6c929a2ea0eacad1c3c59c46bcded2fa72b2c7cd (diff) | |
download | gcc-874a0341c8306d74db689405040a4bc4f550085a.zip gcc-874a0341c8306d74db689405040a4bc4f550085a.tar.gz gcc-874a0341c8306d74db689405040a4bc4f550085a.tar.bz2 |
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
Diffstat (limited to 'gcc/ada/sem_warn.adb')
-rw-r--r-- | gcc/ada/sem_warn.adb | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 530f0af..af50d9c 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -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) |