opt.ads, opt.adb: New flags for persistent_bss mode Add Ada_Version_Explicit...
authorRobert Dewar <dewar@adacore.com>
Thu, 16 Jun 2005 08:43:32 +0000 (10:43 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 16 Jun 2005 08:43:32 +0000 (10:43 +0200)
2005-06-14  Robert Dewar  <dewar@adacore.com>

* opt.ads, opt.adb: New flags for persistent_bss mode
Add Ada_Version_Explicit, for implementation of AI-362
Add Assertions_Enabled_Config and associated handling
Needed since setting can be changed with Assertion_Policy pragma
Add new flag Warn_On_Ada_2005_Compatibility

* switch-c.adb: Recognize -gnatwy/Y
Set Ada_Version_Explicit, for implementation of AI-362
The -gnatg switch now includes -gnatyu

* usage.adb: Add -gnatwy/Y
Remove wrong asterisk on -gnatwX line
Add line for -gnatyu switch

From-SVN: r101049

gcc/ada/opt.adb
gcc/ada/opt.ads
gcc/ada/switch-c.adb
gcc/ada/usage.adb

index 528cbffaf9981631a9d0500a81f601c6cb45a17e..5337e5821fa7f6c661c146f43de2dc39fac625db 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          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 --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -50,11 +50,14 @@ package body Opt is
    procedure Register_Opt_Config_Switches is
    begin
       Ada_Version_Config                    := Ada_Version;
+      Ada_Version_Explicit_Config           := Ada_Version_Explicit;
+      Assertions_Enabled_Config             := Assertions_Enabled;
       Dynamic_Elaboration_Checks_Config     := Dynamic_Elaboration_Checks;
       Exception_Locations_Suppressed_Config := Exception_Locations_Suppressed;
       Extensions_Allowed_Config             := Extensions_Allowed;
       External_Name_Exp_Casing_Config       := External_Name_Exp_Casing;
       External_Name_Imp_Casing_Config       := External_Name_Imp_Casing;
+      Persistent_BSS_Mode_Config            := Persistent_BSS_Mode;
       Polling_Required_Config               := Polling_Required;
       Use_VADS_Size_Config                  := Use_VADS_Size;
    end Register_Opt_Config_Switches;
@@ -66,11 +69,14 @@ package body Opt is
    procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type) is
    begin
       Ada_Version                    := Save.Ada_Version;
+      Ada_Version_Explicit           := Save.Ada_Version_Explicit;
+      Assertions_Enabled             := Save.Assertions_Enabled;
       Dynamic_Elaboration_Checks     := Save.Dynamic_Elaboration_Checks;
       Exception_Locations_Suppressed := Save.Exception_Locations_Suppressed;
       Extensions_Allowed             := Save.Extensions_Allowed;
       External_Name_Exp_Casing       := Save.External_Name_Exp_Casing;
       External_Name_Imp_Casing       := Save.External_Name_Imp_Casing;
+      Persistent_BSS_Mode            := Save.Persistent_BSS_Mode;
       Polling_Required               := Save.Polling_Required;
       Use_VADS_Size                  := Save.Use_VADS_Size;
    end Restore_Opt_Config_Switches;
@@ -82,11 +88,14 @@ package body Opt is
    procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type) is
    begin
       Save.Ada_Version                    := Ada_Version;
+      Save.Ada_Version_Explicit           := Ada_Version_Explicit;
+      Save.Assertions_Enabled             := Assertions_Enabled;
       Save.Dynamic_Elaboration_Checks     := Dynamic_Elaboration_Checks;
       Save.Exception_Locations_Suppressed := Exception_Locations_Suppressed;
       Save.Extensions_Allowed             := Extensions_Allowed;
       Save.External_Name_Exp_Casing       := External_Name_Exp_Casing;
       Save.External_Name_Imp_Casing       := External_Name_Imp_Casing;
+      Save.Persistent_BSS_Mode            := Persistent_BSS_Mode;
       Save.Polling_Required               := Polling_Required;
       Save.Use_VADS_Size                  := Use_VADS_Size;
    end Save_Opt_Config_Switches;
@@ -99,23 +108,28 @@ package body Opt is
    begin
       if Internal_Unit then
          Ada_Version                := Ada_Version_Runtime;
+         Assertions_Enabled         := False;
          Dynamic_Elaboration_Checks := False;
          Extensions_Allowed         := True;
          External_Name_Exp_Casing   := As_Is;
          External_Name_Imp_Casing   := Lowercase;
+         Persistent_BSS_Mode        := False;
          Use_VADS_Size              := False;
 
       else
          Ada_Version                := Ada_Version_Config;
+         Assertions_Enabled         := Assertions_Enabled_Config;
          Dynamic_Elaboration_Checks := Dynamic_Elaboration_Checks_Config;
          Extensions_Allowed         := Extensions_Allowed_Config;
          External_Name_Exp_Casing   := External_Name_Exp_Casing_Config;
          External_Name_Imp_Casing   := External_Name_Imp_Casing_Config;
+         Persistent_BSS_Mode        := Persistent_BSS_Mode_Config;
          Use_VADS_Size              := Use_VADS_Size_Config;
       end if;
 
       Exception_Locations_Suppressed := Exception_Locations_Suppressed_Config;
       Polling_Required               := Polling_Required_Config;
+      Ada_Version_Explicit           := Ada_Version_Explicit_Config;
    end Set_Opt_Config_Switches;
 
    ---------------
@@ -123,8 +137,10 @@ package body Opt is
    ---------------
 
    procedure Tree_Read is
-      Tree_Version_String_Len : Nat;
-      Ada_Version_Config_Val  : Nat;
+      Tree_Version_String_Len         : Nat;
+      Ada_Version_Config_Val          : Nat;
+      Ada_Version_Explicit_Config_Val : Nat;
+      Assertions_Enabled_Config_Val   : Nat;
 
    begin
       Tree_Read_Int  (Tree_ASIS_Version_Number);
@@ -138,12 +154,19 @@ package body Opt is
       Tree_Read_Data (Warning_Mode'Address,
                       Warning_Mode_Type'Object_Size / Storage_Unit);
       Tree_Read_Int  (Ada_Version_Config_Val);
+      Tree_Read_Int  (Ada_Version_Explicit_Config_Val);
+      Tree_Read_Int  (Assertions_Enabled_Config_Val);
       Tree_Read_Bool (All_Errors_Mode);
       Tree_Read_Bool (Assertions_Enabled);
       Tree_Read_Bool (Enable_Overflow_Checks);
       Tree_Read_Bool (Full_List);
 
-      Ada_Version_Config := Ada_Version_Type'Val (Ada_Version_Config_Val);
+      Ada_Version_Config :=
+        Ada_Version_Type'Val (Ada_Version_Config_Val);
+      Ada_Version_Explicit_Config :=
+        Ada_Version_Type'Val (Ada_Version_Explicit_Config_Val);
+      Assertions_Enabled_Config :=
+        Boolean'Val (Assertions_Enabled_Config_Val);
 
       --  Read version string: we have to check the length first
 
@@ -199,6 +222,8 @@ package body Opt is
       Tree_Write_Data (Warning_Mode'Address,
                        Warning_Mode_Type'Object_Size / Storage_Unit);
       Tree_Write_Int  (Ada_Version_Type'Pos (Ada_Version_Config));
+      Tree_Write_Int  (Ada_Version_Type'Pos (Ada_Version_Explicit_Config));
+      Tree_Write_Int  (Boolean'Pos (Assertions_Enabled_Config));
       Tree_Write_Bool (All_Errors_Mode);
       Tree_Write_Bool (Assertions_Enabled);
       Tree_Write_Bool (Enable_Overflow_Checks);
index 29acc92567dd869ce05e5143dc2d61d438ba374b..408fa46edf662127405592ffd0e70d0814f37d82 100644 (file)
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This package contains global flags set by the initialization
---  routine from the command line and referenced throughout the compiler,
---  the binder, gnatmake or other GNAT tools. The comments indicate which
---  options are used by which programs (GNAT, GNATBIND, GNATMAKE, etc).
+--  This package contains global flags set by the initialization routine from
+--  the command line and referenced throughout the compiler, the binder, or
+--  other GNAT tools. The comments indicate which options are used by which
+--  programs (GNAT, GNATBIND, GNATMAKE, etc).
 
 with Gnatvsn;  use Gnatvsn;
 with Hostparm; use Hostparm;
@@ -70,11 +70,23 @@ package Opt is
 
    Ada_Version : Ada_Version_Type := Ada_Version_Default;
    --  GNAT
-   --  Current Ada version for compiler
+   --  Current Ada version for compiler, as set by configuration pragmas,
+   --  compiler switches, or implicitly (to Ada_Version_Runtime) when a
+   --  predefined or internal file is compiled.
+
+   Ada_Version_Explicit : Ada_Version_Type := Ada_Version_Default;
+   --  GNAT
+   --  Like Ada_Version, but does not get set implicitly for predefined
+   --  or internal units, so it reflects the Ada version explicitly set
+   --  using configuration pragmas or compiler switches (or if neither
+   --  appears, it remains set to Ada_Version_Default). This is used in
+   --  the rare cases (notably for pragmas Preelaborate_05 and Pure_05)
+   --  where in the run-time we want the explicit version set.
 
    Ada_Version_Runtime : Ada_Version_Type := Ada_05;
    --  GNAT
-   --  Ada version used to compile the runtime
+   --  Ada version used to compile the runtime. Used to set Ada_Version (but
+   --  not Ada_Version_Explicit) when compiling predefined or internal units.
 
    Ada_Final_Suffix : constant String := "final";
    Ada_Final_Name : String_Ptr := new String'("ada" & Ada_Final_Suffix);
@@ -126,7 +138,7 @@ package Opt is
 
    Assertions_Enabled : Boolean := False;
    --  GNAT
-   --  Enable assertions made using pragma Assert.
+   --  Enable assertions made using pragma Assert
 
    ASIS_Mode : Boolean := False;
    --  GNAT
@@ -153,7 +165,7 @@ package Opt is
 
    Bind_Main_Program : Boolean := True;
    --  GNATBIND
-   --  Set to False if not binding main Ada program.
+   --  Set to False if not binding main Ada program
 
    Bind_For_Library : Boolean := False;
    --  GNATBIND
@@ -192,11 +204,11 @@ package Opt is
 
    Check_Only : Boolean := False;
    --  GNATBIND
-   --  Set to True to do checks only, no output of binder file.
+   --  Set to True to do checks only, no output of binder file
 
    Check_Readonly_Files : Boolean := False;
    --  GNATMAKE
-   --  Set to True to check readonly files during the make process.
+   --  Set to True to check readonly files during the make process
 
    Check_Source_Files : Boolean := True;
    --  GNATBIND, GNATMAKE
@@ -207,7 +219,7 @@ package Opt is
 
    Check_Switches : Boolean := False;
    --  GNATMAKE
-   --  Set to True to check compiler options during the make process.
+   --  Set to True to check compiler options during the make process
 
    Check_Unreferenced : Boolean := False;
    --  GNAT
@@ -216,8 +228,8 @@ package Opt is
 
    Check_Unreferenced_Formals : Boolean := False;
    --  GNAT
-   --  Set True to check for unreferenced formals. This is turned
-   --  on by -gnatwa/wf/wu and turned off by -gnatwA/wF/wU.
+   --  Set True to check for unreferenced formals. This is turned on by
+   --  -gnatwa/wf/wu and turned off by -gnatwA/wF/wU.
 
    Check_Withs : Boolean := False;
    --  GNAT
@@ -377,9 +389,9 @@ package Opt is
                            Front_End_Setjmp_Longjmp_Exceptions;
    --  GNAT
    --  Set to the appropriate value depending on the default as given in
-   --  system.ads (ZCX_By_Default, GCC_ZCX_Support, Front_End_ZCX_Support)
-   --  and the use of -gnatL -gnatZ (and -gnatdX). The C convention is
-   --  there to make this variable accessible to gigi.
+   --  system.ads (ZCX_By_Default, GCC_ZCX_Support, Front_End_ZCX_Support) and
+   --  the use of -gnatL -gnatZ (and -gnatdX). The C convention is there to
+   --  make this variable accessible to gigi.
 
    Exception_Tracebacks : Boolean := False;
    --  GNATBIND
@@ -450,13 +462,6 @@ package Opt is
    --  GNATMAKE
    --  Set to force recompilations even when the objects are up-to-date.
 
-   Force_RM_Elaboration_Order : Boolean := False;
-   --  GNATBIND
-   --  True if binding with forced RM elaboration order (-f switch set)
-   --  Note: this is considered an obsolescent option, to be removed in
-   --  some future release. It is no longer documented. The proper way
-   --  to get this effect is to use -gnatE and suppress elab checks.
-
    Full_Path_Name_For_Brief_Errors : Boolean := False;
    --  GNAT, GNATMAKE, GNATCLEAN
    --  When True, in Brief_Output mode, each error message line
@@ -473,7 +478,7 @@ package Opt is
 
    GCC_Version : constant Nat := get_gcc_version;
    --  GNATMAKE
-   --  Indicates which version of gcc is in use (2 = 2.8.1, 3 = 3.x).
+   --  Indicates which version of gcc is in use (2 = 2.8.1, 3 = 3.x)
 
    Global_Discard_Names : Boolean := False;
    --  GNAT, GNATBIND
@@ -554,7 +559,7 @@ package Opt is
 
    Front_End_Inlining : Boolean := False;
    --  GNAT
-   --  Set True to activate inlining by front-end expansion.
+   --  Set True to activate inlining by front-end expansion
 
    Inline_Processing_Required : Boolean := False;
    --  GNAT
@@ -702,7 +707,7 @@ package Opt is
 
    Minimal_Recompilation : Boolean := False;
    --  GNATMAKE
-   --  Set to True if minimal recompilation mode requested.
+   --  Set to True if minimal recompilation mode requested
 
    Multiple_Unit_Index : Int;
    --  GNAT
@@ -779,6 +784,11 @@ package Opt is
    --  GNATBIND
    --  True if output of list of objects is requested (-O switch set)
 
+   Persistent_BSS_Mode : Boolean := False;
+   --  GNAT
+   --  True if a Persistent_BSS configuration pragma is in effect, causing
+   --  potentially persistent data to be placed in the persistent_bss section.
+
    Pessimistic_Elab_Order : Boolean := False;
    --  GNATBIND
    --  True if pessimistic elaboration order is to be chosen (-p switch set)
@@ -863,12 +873,12 @@ package Opt is
 
    Stack_Checking_Enabled : Boolean;
    --  GNAT
-   --  Set to indicate if -fstack-check switch is set for the compilation.
-   --  True means that the switch is set, so that stack checking is enabled.
-   --  False means that the switch is not set (no stack checking). This
-   --  value is obtained from the external imported value flag_stack_check
-   --  in the gcc backend (see Frontend) and may be referenced throughout
-   --  the compilation phases.
+   --  Set to indicate if -fstack-check switch is set for the compilation. True
+   --  means that the switch is set, so that stack checking is enabled. False
+   --  means that the switch is not set (no stack checking). This value is
+   --  obtained from the external imported value flag_stack_check in the gcc
+   --  backend (see Frontend) and may be referenced throughout the compilation
+   --  phases.
 
    Style_Check : Boolean := False;
    --  GNAT
@@ -888,7 +898,7 @@ package Opt is
    --  is never appropriate in GNAT_Mode (and causes troubles, including
    --  bogus circularities, if we try to compile the run-time library with
    --  a System extension). If GNAT_Mode is not set, then System_Extend_Unit
-   --  is a copy of the value set in System_Extend_Pragma_Ary.
+   --  is a copy of the value set in System_Extend_Pragma_Arg.
 
    Subunits_Missing : Boolean := False;
    --  GNAT
@@ -915,10 +925,10 @@ package Opt is
    Table_Factor : Int := 1;
    --  GNAT
    --  Factor by which all initial table sizes set in Alloc are multiplied.
-   --  Used in Table to calculate initial table sizes (the initial table
-   --  size is the value in Alloc, used as the Table_Initial parameter
-   --  value, multiplied by the factor given here. The default value is
-   --  used if no -gnatT switch appears.
+   --  Used in Table to calculate initial table sizes (the initial table size
+   --  is the value in Alloc, used as the Table_Initial parameter value,
+   --  multiplied by the factor given here. The default value is used if no
+   --  -gnatT switch appears.
 
    Task_Dispatching_Policy : Character := ' ';
    --  GNAT, GNATBIND
@@ -943,18 +953,16 @@ package Opt is
 
    Time_Slice_Value : Nat;
    --  GNATBIND
-   --  Time slice value. Valid only if Time_Slice_Set is True, i.e. if a
-   --  Time_Slice pragma has been processed. Set to the time slice value
-   --  in microseconds. Negative values are stored as zero, and the value
-   --  is not larger than 1_000_000_000 (1000 seconds). Values larger than
-   --  this are reset to this maximum. This can also be set with the -gnatTnn
-   --  switch.
+   --  Time slice value. Valid only if Time_Slice_Set is True, i.e. if
+   --  Time_Slice pragma has been processed. Set to the time slice value in
+   --  microseconds. Negative values are stored as zero, and the value is not
+   --  larger than 1_000_000_000 (1000 seconds). Values larger than this are
+   --  reset to this maximum. This can also be set with the -gnatTnn switch.
 
    Tolerate_Consistency_Errors : Boolean := False;
    --  GNATBIND
-   --  Tolerate time stamp and other consistency errors. If this flag is
-   --  set to True (-t), then inconsistencies result in warnings rather than
-   --  errors.
+   --  Tolerate time stamp and other consistency errors. If this flag is set to
+   --  True (-t), then inconsistencies result in warnings rather than errors.
 
    Tree_Output : Boolean := False;
    --  GNAT
@@ -980,24 +988,24 @@ package Opt is
 
    Universal_Addressing_On_AAMP : Boolean := False;
    --  GNAAMP
-   --  Indicates if library-level objects should be accessed and updated
-   --  using universal addressing instructions on the AAMP architecture.
-   --  This flag is set to True when pragma Universal_Data is given as
-   --  a configuration pragma.
+   --  Indicates if library-level objects should be accessed and updated using
+   --  universal addressing instructions on the AAMP architecture. This flag is
+   --  set to True when pragma Universal_Data is given as a configuration
+   --  pragma.
 
    Unreserve_All_Interrupts : Boolean := False;
    --  GNAT, GNATBIND
-   --  Normally set False, set True if a valid Unreserve_All_Interrupts
-   --  pragma appears anywhere in the main unit for GNAT, or if any ALI
-   --  file has the corresponding attribute set in GNATBIND.
+   --  Normally set False, set True if a valid Unreserve_All_Interrupts pragma
+   --  appears anywhere in the main unit for GNAT, or if any ALI file has the
+   --  corresponding attribute set in GNATBIND.
 
    Upper_Half_Encoding : Boolean := False;
    --  GNAT
    --  Normally set False, indicating that upper half ASCII characters are
    --  used in the normal way to represent themselves. If the wide character
-   --  encoding method uses the upper bit for this encoding, then this flag
-   --  is set True, and upper half characters in the source indicate the
-   --  start of a wide character sequence.
+   --  encoding method uses the upper bit for this encoding, then this flag is
+   --  set True, and upper half characters in the source indicate the start of
+   --  a wide character sequence.
 
    Usage_Requested : Boolean := False;
    --  GNAT, GNATBIND, GNATMAKE
@@ -1012,19 +1020,24 @@ package Opt is
    --  GNAT
    --  This flag determines if validity checking is on or off. The initial
    --  state is on, and the required default validity checks are active. The
-   --  actual set of checks that is performed if Validity_Checks_On is set
-   --  is defined by the switches in package Sem_Val. The Validity_Checks_On
-   --  flag is controlled by pragma Validity_Checks (On | Off), and also
-   --  some generated compiler code (typically code that has to do with
-   --  validity check generation) is compiled with this flag set to False.
-   --  This flag is set to False by the -gnatp switch.
+   --  actual set of checks that is performed if Validity_Checks_On is set is
+   --  defined by the switches in package Sem_Val. The Validity_Checks_On flag
+   --  is controlled by pragma Validity_Checks (On | Off), and also some
+   --  generated compiler code (typically code that has to do with validity
+   --  check generation) is compiled with this flag set to False. This flag is
+   --  set to False by the -gnatp switch.
 
    Verbose_Mode : Boolean := False;
-   --  GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATCHOP, GNATNAME,
-   --  GNATCLEAN
+   --  GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN
    --  Set to True to get verbose mode (full error message text and location
    --  information sent to standard output, also header, copyright and summary)
 
+   Warn_On_Ada_2005_Compatibility : Boolean := True;
+   --  GNAT
+   --  Set to True to active all warnings on Ada 2005 compatibility issues,
+   --  including warnings on Ada 2005 obsolescent features used in Ada 2005
+   --  mode. Set False by -gnatwY.
+
    Warn_On_Bad_Fixed_Value : Boolean := False;
    --  GNAT
    --  Set to True to generate warnings for static fixed-point expression
@@ -1052,8 +1065,8 @@ package Opt is
 
    Warn_On_Modified_Unread : Boolean := False;
    --  GNAT
-   --  Set to True to generate warnings if a variable is assigned but is
-   --  never read. The default is that this warning is suppressed.
+   --  Set to True to generate warnings if a variable is assigned but is never
+   --  read. The default is that this warning is suppressed.
 
    Warn_On_No_Value_Assigned : Boolean := True;
    --  GNAT
@@ -1063,8 +1076,8 @@ package Opt is
 
    Warn_On_Obsolescent_Feature : Boolean := False;
    --  GNAT
-   --  Set to True to generate warnings on use of any feature in Annex J
-   --  or if a subprogram is called for which a pragma Obsolescent applies.
+   --  Set to True to generate warnings on use of any feature in Annex or if a
+   --  subprogram is called for which a pragma Obsolescent applies.
 
    Warn_On_Redundant_Constructs : Boolean := False;
    --  GNAT
@@ -1096,10 +1109,10 @@ package Opt is
    --  description of type in unit System.WCh_Con for a list of the methods
    --  that are currently supported. Note that brackets notation is always
    --  recognized in source programs regardless of the setting of this
-   --  variable. The default setting causes only the brackets notation
-   --  to be recognized. If this is the main unit, this setting also
-   --  controls the output of the W=? parameter in the ALI file, which
-   --  is used to provide the default for Wide_Text_IO files.
+   --  variable. The default setting causes only the brackets notation to be
+   --  recognized. If this is the main unit, this setting also controls the
+   --  output of the W=? parameter in the ALI file, which is used to provide
+   --  the default for Wide_Text_IO files.
 
    Xref_Active : Boolean := True;
    --  GNAT
@@ -1109,28 +1122,39 @@ package Opt is
    Zero_Cost_Exceptions_Set : Boolean := False;
    --  GNAT
    --  These values are to record the setting of the zero cost exception
-   --  handling mode set by argument switches (-gnatZ/-gnatL). If the
-   --  value is set by one of these switches, then Zero_Cost_Exceptions_Set
-   --  is set to True, and Zero_Cost_Exceptions_Val indicates the setting.
+   --  handling mode set by argument switches (-gnatZ/-gnatL). If the value is
+   --  set by one of these switches, then Zero_Cost_Exceptions_Set is set to
+   --  True, and Zero_Cost_Exceptions_Val indicates the setting.
 
    ----------------------------
    -- Configuration Settings --
    ----------------------------
 
-   --  These are settings that are used to establish the mode at the start
-   --  of each unit. The values defined below can be affected either by
-   --  command line switches, or by the use of appropriate configuration
-   --  pragmas in the gnat.adc file.
+   --  These are settings that are used to establish the mode at the start of
+   --  each unit. The values defined below can be affected either by command
+   --  line switches, or by the use of appropriate configuration pragmas in the
+   --  gnat.adc file.
 
    Ada_Version_Config : Ada_Version_Type;
    --  GNAT
    --  This is the value of the configuration switch for the Ada 83 mode, as
-   --  set by the command line switches -gnat83/95/05, and possibly modified
-   --  by the use of configuration pragmas Ada_83/Ada95/Ada05. This switch
-   --  is used to set the initial value for Ada_Version mode at the start
-   --  of analysis of a unit. Note however, that the setting of this flag
-   --  is ignored for internal and predefined units (which are always compiled
-   --  in the most up to date version of Ada).
+   --  set by the command line switches -gnat83/95/05, and possibly modified by
+   --  the use of configuration pragmas Ada_83/Ada95/Ada05. This switch is used
+   --  to set the initial value for Ada_Version mode at the start of analysis
+   --  of a unit. Note however, that the setting of this flag is ignored for
+   --  internal and predefined units (which are always compiled in the most up
+   --  to date version of Ada).
+
+   Ada_Version_Explicit_Config : Ada_Version_Type;
+   --  GNAT
+   --  Same as above but used to initialize Ada_Version_Explicit. Currently
+   --  this will always have the same value as Ada_Version_Config.
+
+   Assertions_Enabled_Config : Boolean;
+   --  GNAT
+   --  This is the value of the configuration switch for assertions enabled
+   --  mode, as possibly set by the command line switch -gnata, and possibly
+   --  modified by the use of the configuration pragma Assertion_Policy.
 
    Dynamic_Elaboration_Checks_Config : Boolean := False;
    --  GNAT
@@ -1143,73 +1167,82 @@ package Opt is
 
    Extensions_Allowed_Config : Boolean;
    --  GNAT
-   --  This is the flag that indicates whether extensions are allowed.
-   --  It can be set True either by use of the -gnatX switch, or by use
-   --  of the configuration pragma Extensions_Allowed (On). It is always
-   --  set to True for internal GNAT units, since extensions are always
-   --  permitted in such units.
+   --  This is the flag that indicates whether extensions are allowed. It can
+   --  be set True either by use of the -gnatX switch, or by use of the
+   --  configuration pragma Extensions_Allowed (On). It is always set to True
+   --  for internal GNAT units, since extensions are always permitted in such
+   --  units.
 
    External_Name_Exp_Casing_Config : External_Casing_Type;
    --  GNAT
-   --  This is the value of the configuration switch that controls casing
-   --  of external symbols for which an explicit external name is given. It
-   --  can be set to Uppercase by the command line switch -gnatF, and further
-   --  modified by the use of the configuration pragma External_Name_Casing
-   --  in the gnat.adc file. This flag is used to set the initial value
-   --  for External_Name_Exp_Casing at the start of analyzing each unit.
-   --  Note however that the setting of this flag is ignored for internal
-   --  and predefined units (which are always compiled with As_Is mode).
+   --  This is the value of the configuration switch that controls casing of
+   --  external symbols for which an explicit external name is given. It can be
+   --  set to Uppercase by the command line switch -gnatF, and further modified
+   --  by the use of the configuration pragma External_Name_Casing in the
+   --  gnat.adc file. This flag is used to set the initial value for
+   --  External_Name_Exp_Casing at the start of analyzing each unit. Note
+   --  however that the setting of this flag is ignored for internal and
+   --  predefined units (which are always compiled with As_Is mode).
 
    External_Name_Imp_Casing_Config : External_Casing_Type;
    --  GNAT
-   --  This is the value of the configuration switch that controls casing
-   --  of external symbols where the external name is implicitly given. It
-   --  can be set to Uppercase by the command line switch -gnatF, and further
-   --  modified by the use of the configuration pragma External_Name_Casing
-   --  in the gnat.adc file. This flag is used to set the initial value
-   --  for External_Name_Imp_Casing at the start of analyzing each unit.
-   --  Note however that the setting of this flag is ignored for internal
-   --  and predefined units (which are always compiled with Lowercase mode).
+   --  This is the value of the configuration switch that controls casing of
+   --  external symbols where the external name is implicitly given. It can be
+   --  set to Uppercase by the command line switch -gnatF, and further modified
+   --  by the use of the configuration pragma External_Name_Casing in the
+   --  gnat.adc file. This flag is used to set the initial value for
+   --  External_Name_Imp_Casing at the start of analyzing each unit. Note
+   --  however that the setting of this flag is ignored for internal and
+   --  predefined units (which are always compiled with Lowercase mode).
+
+   Persistent_BSS_Mode_Config : Boolean;
+   --  GNAT
+   --  This is the value of the configuration switch that controls whether
+   --  potentially persistent data is to be placed in the persistent_bss
+   --  section. It can be set True by use of the pragma Persistent_BSS.
+   --  This flag is used to set the initial value of Persistent_BSS_Mode
+   --  at the start of each compilation unit, except that it is always
+   --  set False for predefined units.
 
    Polling_Required_Config : Boolean;
    --  GNAT
    --  This is the value of the configuration switch that controls polling
    --  mode. It can be set True by the command line switch -gnatP, and then
-   --  further modified by the use of pragma Polling in the gnat.adc file.
-   --  This flag is used to set the initial value for Polling_Required
-   --  at the start of analyzing each unit.
+   --  further modified by the use of pragma Polling in the gnat.adc file. This
+   --  flag is used to set the initial value for Polling_Required at the start
+   --  of analyzing each unit.
 
    Use_VADS_Size_Config : Boolean;
    --  GNAT
-   --  This is the value of the configuration switch that controls the use
-   --  of VADS_Size instead of Size whereever the attribute Size is used.
-   --  It can be set True by the use of the pragma Use_VADS_Size in the
-   --  gnat.adc file. This flag is used to set the initial value for
-   --  Use_VADS_Size at the start of analyzing each unit. Note however that
-   --  the setting of this flag is ignored for internal and predefined
-   --  units (which are always compiled with the standard Size semantics).
+   --  This is the value of the configuration switch that controls the use of
+   --  VADS_Size instead of Size whereever the attribute Size is used. It can
+   --  be set True by the use of the pragma Use_VADS_Size in the gnat.adc file.
+   --  This flag is used to set the initial value for Use_VADS_Size at the
+   --  start of analyzing each unit. Note however that the setting of this flag
+   --  is ignored for internal and predefined units (which are always compiled
+   --  with the standard Size semantics).
 
    type Config_Switches_Type is private;
    --  Type used to save values of the switches set from Config values
 
    procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type);
    --  This procedure saves the current values of the switches which are
-   --  initialized from the above Config values, and then resets these
-   --  switches according to the Config value settings.
+   --  initialized from the above Config values, and then resets these switches
+   --  according to the Config value settings.
 
    procedure Set_Opt_Config_Switches (Internal_Unit : Boolean);
-   --  This procedure sets the switches to the appropriate initial values.
-   --  The parameter Internal_Unit is True for an internal or predefined
-   --  unit, and affects the way the switches are set (see above).
+   --  This procedure sets the switches to the appropriate initial values. The
+   --  parameter Internal_Unit is True for an internal or predefined unit, and
+   --  affects the way the switches are set (see above).
 
    procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
-   --  This procedure restores a set of switch values previously saved
-   --  by a call to Save_Opt_Switches.
+   --  This procedure restores a set of switch values previously saved by a
+   --  call to Save_Opt_Switches.
 
    procedure Register_Opt_Config_Switches;
    --  This procedure is called after processing the gnat.adc file to record
-   --  the values of the Config switches, as possibly modified by the use
-   --  of command line switches and configuration pragmas.
+   --  the values of the Config switches, as possibly modified by the use of
+   --  command line switches and configuration pragmas.
 
    ------------------------
    -- Other Global Flags --
@@ -1220,10 +1253,10 @@ package Opt is
    --  (False). When expansion is deactivated all calls to expander routines
    --  have no effect. Note that the initial setting of False is merely to
    --  prevent saving of an undefined value for an initial call to the
-   --  Expander_Mode_Save_And_Set procedure. For more information on the
-   --  use of this flag, see package Expander. Indeed this flag might more
-   --  logically be in the spec of Expander, but it is referenced by Errout,
-   --  and it really seems wrong for Errout to depend on Expander.
+   --  Expander_Mode_Save_And_Set procedure. For more information on the use of
+   --  this flag, see package Expander. Indeed this flag might more logically
+   --  be in the spec of Expander, but it is referenced by Errout, and it
+   --  really seems wrong for Errout to depend on Expander.
 
    -----------------------
    -- Tree I/O Routines --
@@ -1248,12 +1281,12 @@ package Opt is
    --  from the Gnatvsn package which is a part of ASIS implementation.
 
    Tree_Version_String : String (Gnat_Version_String'Range);
-   --  Used to store the compiler version string read from a tree file to
-   --  check if it is the same as stored in the version string in Gnatvsn.
-   --  Therefore its length is taken directly from the version string in
-   --  Gnatvsn. If the length of the version string stored in the tree is
-   --  different, then versions are for sure different, and a string containing
-   --  '?' characters is assigned to this variable as a result of tree read.
+   --  Used to store the compiler version string read from a tree file to check
+   --  if it is the same as stored in the version string in Gnatvsn. Therefore
+   --  its length is taken directly from the version string in Gnatvsn. If the
+   --  length of the version string stored in the tree is different, then
+   --  versions are for sure different, and a string containing '?' characters
+   --  is assigned to this variable as a result of tree read.
 
    Tree_ASIS_Version_Number : Int;
    --  Used to store the ASIS version number read from a tree file to check if
@@ -1263,11 +1296,14 @@ private
 
    type Config_Switches_Type is record
       Ada_Version                    : Ada_Version_Type;
+      Ada_Version_Explicit           : Ada_Version_Type;
+      Assertions_Enabled             : Boolean;
       Dynamic_Elaboration_Checks     : Boolean;
       Exception_Locations_Suppressed : Boolean;
       Extensions_Allowed             : Boolean;
       External_Name_Exp_Casing       : External_Casing_Type;
       External_Name_Imp_Casing       : External_Casing_Type;
+      Persistent_BSS_Mode            : Boolean;
       Polling_Required               : Boolean;
       Use_VADS_Size                  : Boolean;
    end record;
index a91f9ea464e80ec4a949b79d2e86bdc5d76062a4..7613e735879b3d0686f7aa4baf5b5b68a3de0a96 100644 (file)
@@ -503,7 +503,7 @@ package body Switch.C is
                Warn_On_Unchecked_Conversion := True;
                Warn_On_Unrecognized_Pragma  := True;
 
-               Set_Style_Check_Options ("3abcdefhiklmnprst");
+               Set_Style_Check_Options ("3abcdefhiklmnprstu");
 
             --  Processing for G switch
 
@@ -763,6 +763,7 @@ package body Switch.C is
                         Constant_Condition_Warnings     := True;
                         Implementation_Unit_Warnings    := True;
                         Ineffective_Inline_Warnings     := True;
+                        Warn_On_Ada_2005_Compatibility  := True;
                         Warn_On_Bad_Fixed_Value         := True;
                         Warn_On_Constant                := True;
                         Warn_On_Export_Import           := True;
@@ -781,6 +782,7 @@ package body Switch.C is
                         Elab_Warnings                   := False;
                         Implementation_Unit_Warnings    := False;
                         Ineffective_Inline_Warnings     := False;
+                        Warn_On_Ada_2005_Compatibility  := False;
                         Warn_On_Bad_Fixed_Value         := False;
                         Warn_On_Constant                := False;
                         Warn_On_Dereference             := False;
@@ -908,6 +910,12 @@ package body Switch.C is
                      when 'X' =>
                         Warn_On_Export_Import           := False;
 
+                     when 'y' =>
+                        Warn_On_Ada_2005_Compatibility  := True;
+
+                     when 'Y' =>
+                        Warn_On_Ada_2005_Compatibility  := False;
+
                      when 'z' =>
                         Warn_On_Unchecked_Conversion    := True;
 
@@ -972,6 +980,7 @@ package body Switch.C is
                Ptr := Ptr + 1;
                Extensions_Allowed := True;
                Ada_Version := Ada_Version_Type'Last;
+               Ada_Version_Explicit := Ada_Version;
 
             --  Processing for y switch
 
@@ -1067,6 +1076,7 @@ package body Switch.C is
                else
                   Ptr := Ptr + 1;
                   Ada_Version := Ada_83;
+                  Ada_Version_Explicit := Ada_Version;
                end if;
 
             --  Processing for 95 switch
@@ -1083,6 +1093,7 @@ package body Switch.C is
                else
                   Ptr := Ptr + 1;
                   Ada_Version := Ada_95;
+                  Ada_Version_Explicit := Ada_Version;
                end if;
 
             --  Processing for 05 switch
@@ -1099,6 +1110,7 @@ package body Switch.C is
                else
                   Ptr := Ptr + 1;
                   Ada_Version := Ada_05;
+                  Ada_Version_Explicit := Ada_Version;
                end if;
 
             --  Ignore extra switch character
index e57f9ed5b7258a52c0a8e26db5c68f1e9922e55f..dd6e5be802c089b1401cd6e58a6cc8795b9e57fc 100644 (file)
@@ -390,7 +390,9 @@ begin
    Write_Line ("        v*   turn on warnings for unassigned variable");
    Write_Line ("        V    turn off warnings for unassigned variable");
    Write_Line ("        x*   turn on warnings for export/import");
-   Write_Line ("        X*   turn off warnings for export/import");
+   Write_Line ("        X    turn off warnings for export/import");
+   Write_Line ("        y*   turn on warnings for Ada 2005 incompatibility");
+   Write_Line ("        Y    turn off warnings for Ada 2005 incompatibility");
    Write_Line ("        z*   turn on size/align warnings for " &
                                                   "unchecked conversion");
    Write_Line ("        Z    turn off size/align warnings for " &
@@ -450,6 +452,7 @@ begin
    Write_Line ("        r    check casing for identifier references");
    Write_Line ("        s    check separate subprogram specs present");
    Write_Line ("        t    check token separation rules");
+   Write_Line ("        u    check no unnecessary blank lines");
    Write_Line ("        x    check extra parens around conditionals");
 
    --  Lines for -gnatyN switch