-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- 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).
+-- programs (GNAT, GNATBIND, GNATLINK, GNATMAKE, GPRMAKE, etc).
+
+-- Some flags are labelled "PROJECT MANAGER". These are used by tools that
+-- use the Project Manager. These tools include gnatmake, gnatname, the gnat
+-- driver, gnatclean, gprbuild and gprclean.
-with Gnatvsn; use Gnatvsn;
with Hostparm; use Hostparm;
with Types; use Types;
+with System.Strings; use System.Strings;
with System.WCh_Con; use System.WCh_Con;
-with GNAT.Strings; use GNAT.Strings;
package Opt is
-- The following mode values represent the current state of processing.
-- The values set here are the default values. Unless otherwise noted,
- -- the value may be reset in Switch with an appropropiate switch. In
+ -- the value may be reset in Switch-? with an appropriate switch. In
-- some cases, the values can also be modified by pragmas, and in the
-- case of some binder variables, Gnatbind.Scan_Bind_Arg may modify
-- the default values.
-- Set True if binder file to be generated in Ada rather than C
type Ada_Version_Type is (Ada_83, Ada_95, Ada_05);
+ pragma Warnings (Off, Ada_Version_Type);
-- Versions of Ada for Ada_Version below. Note that these are ordered,
-- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
+ -- The Warnings_Off pragma stops warnings for Ada_Version >= Ada_05,
+ -- which we want to allow, so that things work OK when Ada_15 is added!
+ -- This warning is now removed, so this pragma can be removed some time???
- Ada_Version_Default : Ada_Version_Type := Ada_95;
+ Ada_Version_Default : Ada_Version_Type := Ada_05;
-- GNAT
-- Default Ada version if no switch given
-- 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);
+ Ada_Final_Name : String_Ptr := new String'("ada" & Ada_Final_Suffix);
-- GNATBIND
-- The name of the procedure that performs the finalization at the end of
-- execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
Ada_Init_Suffix : constant String := "init";
- Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix);
+ Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix);
-- GNATBIND
-- The name of the procedure that performs initialization at the start
-- of execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
-- GNAT
-- Flag set to force display of multiple errors on a single line and
-- also repeated error messages for references to undefined identifiers
- -- and certain other repeated error messages.
+ -- and certain other repeated error messages. Set by use of -gnatf.
All_Sources : Boolean := False;
-- GNATBIND
-- Set to non null when Bind_Alternate_Main_Name is True. This value
-- is modified as needed by Gnatbind.Scan_Bind_Arg.
- Assertions_Enabled : Boolean := False;
- -- GNAT
- -- Enable assertions made using pragma Assert
-
ASIS_Mode : Boolean := False;
-- GNAT
-- Enable semantic checks and tree transformations that are important
-- it ON. It is set ON when Tree_Output is set ON, it can also be set ON
-- from the code of GNSA-based tool (a client may need to set ON the
-- Back_Annotate_Rep_Info flag in this case. At the moment this does not
- -- make very much sense, because GNSA can not do back annotation).
+ -- make very much sense, because GNSA cannot do back annotation).
+
+ Assertions_Enabled : Boolean := False;
+ -- GNAT
+ -- Enable assertions made using pragma Assert
+
+ Assume_No_Invalid_Values : Boolean := False;
+ -- GNAT
+ -- Normally, in accordance with (RM 13.9.1 (9-11)) the front end assumes
+ -- that values could have invalid representations, unless it can clearly
+ -- prove that the values are valid. If this switch is set (by -gnatB or by
+ -- pragma Assume_No_Invalid_Values (Off)), then the compiler assumes values
+ -- are valid and in range of their representations. This feature is now
+ -- fully enabled in the compiler.
Back_Annotate_Rep_Info : Boolean := False;
-- GNAT
-- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
Bind_Only : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE, GPRBUILD
-- Set to True to skip compile and link steps
-- (except when Compile_Only and/or Link_Only are True).
-- GNATBIND
-- Set to True to do checks only, no output of binder file
+ Check_Policy_List : Node_Id := Empty;
+ -- GNAT
+ -- This points to the list of N_Pragma nodes for Check_Policy pragmas
+ -- that are linked through the Next_Pragma fields, with the list being
+ -- terminated by Empty. The order is most recently processed first.
+
Check_Readonly_Files : Boolean := False;
-- GNATMAKE
-- Set to True to check readonly files during the make process
-- directly modified by gnatmake, to affect the shared binder routines.
Check_Switches : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE, GPBUILD
-- Set to True to check compiler options during the make process
Check_Unreferenced : Boolean := False;
-- Set to True to enable checking for unused withs, and also the case
-- of withing a package and using none of the entities in the package.
+ CodePeer_Mode : Boolean := False;
+ -- GNAT
+ -- Enable full CodePeer mode (SCIL generation, disable switches that
+ -- interact badly with it, etc...).
+
+ Commands_To_Stdout : Boolean := False;
+ -- GNATMAKE
+ -- True if echoed commands to be written to stdout instead of stderr
+
Comment_Deleted_Lines : Boolean := False;
-- GNATPREP
-- True if source lines removed by the preprocessor should be commented
-- in the output file.
Compile_Only : Boolean := False;
- -- GNATMAKE, GNATCLEAN
- -- GNATMAKE: set to True to skip bind and link steps (except when
- -- Bind_Only is True).
- -- GNATCLEAN: set to True to only the files produced by the compiler are to
- -- be deleted, but not the library files or executable files.
+ -- GNATMAKE, GNATCLEAN, GPRMAKE, GPBUILD, GPRCLEAN
+ -- GNATMAKE, GPRMAKE, GPRMAKE:
+ -- set to True to skip bind and link steps (except when Bind_Only is
+ -- True).
+ -- GNATCLEAN, GPRCLEAN:
+ -- set to True to delete only the files produced by the compiler but not
+ -- the library files or the executable files.
Config_File : Boolean := True;
-- GNAT
-- Set to True to activate warnings on constant conditions
Create_Mapping_File : Boolean := False;
- -- GNATMAKE
- -- Set to True (-C switch) to indicate that gnatmake will invoke
- -- the compiler with a mapping file (-gnatem compiler switch).
+ -- GNATMAKE, GPRMAKE
+ -- Set to True (-C switch) to indicate that the compiler will be invoked
+ -- with a mapping file (-gnatem compiler switch).
Debug_Pragmas_Enabled : Boolean := False;
-- GNAT
-- Set the default exit status value. Set by the -Xnnn switch for the
-- binder.
+ Default_Stack_Size : Int := -1;
+ -- GNATBIND
+ -- Set to default primary stack size in units of bytes. Set by
+ -- the -dnnn switch for the binder. A value of -1 indicates that no
+ -- default was set by the binder.
+
Default_Sec_Stack_Size : Int := -1;
-- GNATBIND
- -- Set to default secondary stack size in units of kilobytes. Set by
+ -- Set to default secondary stack size in units of bytes. Set by
-- the -Dnnn switch for the binder. A value of -1 indicates that no
-- default was set by the binder, and that the default should be the
-- initial value of System.Secondary_Stack.Default_Secondary_Stack_Size.
-- potentially blocking operations are detected from protected actions.
Display_Compilation_Progress : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE, GPRBUILD
-- Set True (-d switch) to display information on progress while compiling
-- files. Internal flag to be used in conjunction with an IDE (e.g GPS).
-- GNATMAKE
-- Set to True if no actual compilations should be undertaken.
+ Dump_Source_Text : Boolean := False;
+ -- GNAT
+ -- Set to True (by -gnatL) to dump source text intermingled with generated
+ -- code. Effective only if either of Debug/Print_Generated_Code is true.
+
Dynamic_Elaboration_Checks : Boolean := False;
-- GNAT
-- Set True for dynamic elaboration checking mode, as set by the -gnatE
-- switch or by the use of pragma Elaboration_Checks (Dynamic).
+ Dynamic_Stack_Measurement : Boolean := False;
+ -- GNATBIND
+ -- Set True to enable dynamic stack measurement (-u flag for gnatbind)
+
+ Dynamic_Stack_Measurement_Array_Size : Nat := 100;
+ -- GNATBIND
+ -- Number of measurements we want to store during dynamic stack analysis.
+ -- When the buffer is full, non-storable results will be output on the fly.
+ -- The value is relevant only if Dynamic_Stack_Measurement is set. Set
+ -- by processing of -u flag for gnatbind.
+
Elab_Dependency_Output : Boolean := False;
-- GNATBIND
-- Set to True to output complete list of elaboration constraints
-- Set to True if -gnato (enable overflow checks) switch is set,
-- but not -gnatp.
+ Error_Msg_Line_Length : Nat := 0;
+ -- GNAT
+ -- Records the error message line length limit. If this is set to zero,
+ -- then we get the old style behavior, in which each call to the error
+ -- message routines generates one line of output as a separate message.
+ -- If it is set to a non-zero value, then continuation lines are folded
+ -- to make a single long message, and then this message is split up into
+ -- multiple lines not exceeding the specified length. Set by -gnatj=nn.
+
+ Exception_Handler_Encountered : Boolean := False;
+ -- GNAT
+ -- This flag is set true if the parser encounters an exception handler.
+ -- It is used to set Warn_On_Exception_Propagation True if the restriction
+ -- No_Exception_Propagation is set.
+
Exception_Locations_Suppressed : Boolean := False;
-- GNAT
-- This flag is set True if a Suppress_Exception_Locations configuration
Extensions_Allowed : Boolean := False;
-- GNAT
-- Set to True by switch -gnatX if GNAT specific language extensions
- -- are allowed. For example, "limited with" is a GNAT extension.
+ -- are allowed. For example, the use of 'Constrained with objects of
+ -- generic types is a GNAT extension.
type External_Casing_Type is (
As_Is, -- External names cased as they appear in the Ada source
-- When True (set by gnatmake switch -x), allow compilation of sources
-- that are not part of any project file.
+ Fast_Math : Boolean := False;
+ -- GNAT
+ -- Indicates the current setting of Fast_Math mode, as set by the use
+ -- of a Fast_Math pragma (set on by Fast_Math (On)).
+
Float_Format : Character := ' ';
-- GNAT
-- A non-blank value indicates that a Float_Format pragma has been
-- (-F switch set).
Force_Compilations : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE, GPRBUILD
-- Set to force recompilations even when the objects are up-to-date.
Full_Path_Name_For_Brief_Errors : Boolean := False;
- -- GNAT, GNATMAKE, GNATCLEAN
+ -- PROJECT MANAGER
-- When True, in Brief_Output mode, each error message line
-- will start with the full path name of the source.
-- When False, only the file name without directory information
-- GNAT
-- Set True to generate full source listing with embedded errors
- function get_gcc_version return Int;
- pragma Import (C, get_gcc_version, "get_gcc_version");
+ Full_List_File_Name : String_Ptr := null;
+ -- GNAT
+ -- Set to file name to generate full source listing to named file (or if
+ -- the name is of the form .xxx, then to name.xxx where name is the source
+ -- file name with extension stripped.
- GCC_Version : constant Nat := get_gcc_version;
- -- GNATMAKE
- -- Indicates which version of gcc is in use (2 = 2.8.1, 3 = 3.x)
+ Generate_Processed_File : Boolean := False;
+ -- GNAT
+ -- True when switch -gnateG is used. When True, create in a file
+ -- <source>.prep, if the source is preprocessed.
+
+ Generate_SCO : Boolean := False;
+ -- GNAT
+ -- True when switch -gnateS is used. When True, Source Coverage Obligation
+ -- (SCO) information is generated and output in the ALI file. See unit
+ -- Par_SCO for full details.
+
+ Generating_Code : Boolean := False;
+ -- GNAT
+ -- True if the frontend finished its work and has called the backend to
+ -- process the tree and generate the object file.
Global_Discard_Names : Boolean := False;
-- GNAT, GNATBIND
- -- Set true if a pragma Discard_Names applies to the current unit
+ -- True if a pragma Discard_Names appeared as a configuration pragma for
+ -- the current compilation unit.
GNAT_Mode : Boolean := False;
-- GNAT
-- GNAT
-- True if High Level Optimizer is activated (-gnatH switch)
- Implementation_Unit_Warnings : Boolean := True;
- -- GNAT
- -- Set True to active warnings for use of implementation internal units.
- -- Can be controlled by use of -gnatwi/-gnatwI.
-
Identifier_Character_Set : Character;
-- GNAT
-- This variable indicates the character set to be used for identifiers.
-- default value appropriate to the system (in Osint.Initialize), and then
-- reset if a command line switch is used to change the setting.
+ Ignore_Rep_Clauses : Boolean := False;
+ -- GNAT
+ -- Set True to ignore all representation clauses. Useful when compiling
+ -- code from foreign compilers for checking or ASIS purposes. Can be
+ -- set True by use of -gnatI.
+
+ Implementation_Unit_Warnings : Boolean := True;
+ -- GNAT
+ -- Set True to active warnings for use of implementation internal units.
+ -- Can be controlled by use of -gnatwi/-gnatwI.
+
+ Implicit_Packing : Boolean := False;
+ -- GNAT
+ -- If set True, then a Size attribute clause on an array is allowed to
+ -- cause implicit packing instead of generating an error message. Set by
+ -- use of pragma Implicit_Packing.
+
Ineffective_Inline_Warnings : Boolean := False;
-- GNAT
-- Set True to activate warnings if front-end inlining (-gnatN) is not
-- then elaboration flag checks are to be generated in the binder
-- generated file.
- Follow_Links : Boolean := False;
- -- GNATMAKE
- -- Set to True (-eL) to process the project files in trusted mode
+ Generate_SCIL : Boolean := False;
+ -- GNAT
+ -- Set True to activate SCIL code generation.
+
+ Invalid_Value_Used : Boolean := False;
+ -- GNAT
+ -- Set True if a valid Invalid_Value attribute is encountered
+
+ Follow_Links_For_Files : Boolean := False;
+ -- PROJECT MANAGER
+ -- Set to True (-eL) to process the project files in trusted mode. If
+ -- Follow_Links is False, it is assumed that the project doesn't contain
+ -- any file duplicated through symbolic links (although the latter are
+ -- still valid if they point to a file which is outside of the project),
+ -- and that no directory has a name which is a valid source name.
+
+ Follow_Links_For_Dirs : Boolean := False;
+ -- PROJECT MANAGER
+ -- Set to True if directories can be links in this project, and therefore
+ -- additional system calls must be performed to ensure that we always see
+ -- the same full name for each directory.
Front_End_Inlining : Boolean := False;
-- GNAT
Inline_Processing_Required : Boolean := False;
-- GNAT
- -- Set True if inline processing is required. Inline processing is
- -- required if an active Inline pragma is processed. The flag is set
- -- for a pragma Inline or Inline_Always that is actually active.
+ -- Set True if inline processing is required. Inline processing is required
+ -- if an active Inline pragma is processed. The flag is set for a pragma
+ -- Inline or Inline_Always that is actually active.
In_Place_Mode : Boolean := False;
-- GNATMAKE
- -- Set True to store ALI and object files in place ie in the object
+ -- Set True to store ALI and object files in place i.e. in the object
-- directory if these files already exist or in the source directory
-- if not.
Keep_Going : Boolean := False;
- -- GNATMAKE
- -- When True signals gnatmake to ignore compilation errors and keep
- -- processing sources until there is no more work.
+ -- GNATMAKE, GPRMAKE, GPRBUILD
+ -- When True signals to ignore compilation errors and keep processing
+ -- sources until there is no more work.
Keep_Temporary_Files : Boolean := False;
-- GNATCMD
-- When True the temporary files created by the GNAT driver are not
-- deleted. Set by switch -dn or qualifier /KEEP_TEMPORARY_FILES.
+ Leap_Seconds_Support : Boolean := False;
+ -- GNATBIND
+ -- Set to True to enable leap seconds support in Ada.Calendar and its
+ -- children.
+
Link_Only : Boolean := False;
- -- GNATMAKE
- -- Set to True to skip compile and bind steps
- -- (except when Bind_Only is set to True).
+ -- GNATMAKE, GPRMAKE, GPRBUILD
+ -- Set to True to skip compile and bind steps (except when Bind_Only is
+ -- set to True).
List_Restrictions : Boolean := False;
-- GNATBIND
-- GNAT
-- List units in the active library for a compilation (-gnatu switch)
+ List_Closure : Boolean := False;
+ -- GNATBIND
+ -- List all sources in the closure of a main (-R gnatbind switch)
+
List_Dependencies : Boolean := False;
-- GNATMAKE
-- When True gnatmake verifies that the objects are up to date and
List_Representation_Info_To_File : Boolean := False;
-- GNAT
- -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3
- -- to be written to file.rep (where file is the name of the source
- -- file) instead of stdout. For example, if file x.adb is compiled
- -- using -gnatR2s then representation info is written to x.adb.ref.
+ -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3 to be
+ -- written to file.rep (where file is the name of the source file) instead
+ -- of stdout. For example, if file x.adb is compiled using -gnatR2s then
+ -- representation info is written to x.adb.ref.
List_Representation_Info_Mechanisms : Boolean := False;
-- GNAT
- -- Set true by -gnatRm switch. Causes information on mechanisms to
- -- be included in the representation output information.
+ -- Set true by -gnatRm switch. Causes information on mechanisms to be
+ -- included in the representation output information.
List_Preprocessing_Symbols : Boolean := False;
-- GNAT, GNATPREP
-- Set to True if symbols for preprocessing a source are to be listed
- -- before preprocessing occurs. Set to True by switch -s of gnatprep
- -- or -s in preprocessing data file for the compiler.
+ -- before preprocessing occurs. Set to True by switch -s of gnatprep or
+ -- -s in preprocessing data file for the compiler.
- type Creat_Repinfo_File_Proc is access procedure (Src : File_Name_Type);
- type Write_Repinfo_Line_Proc is access procedure (Info : String);
- type Close_Repinfo_File_Proc is access procedure;
+ type Create_Repinfo_File_Proc is access procedure (Src : String);
+ type Write_Repinfo_Line_Proc is access procedure (Info : String);
+ type Close_Repinfo_File_Proc is access procedure;
-- Types used for procedure addresses below
- Creat_Repinfo_File_Access : Creat_Repinfo_File_Proc := null;
- Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null;
- Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null;
+ Create_Repinfo_File_Access : Create_Repinfo_File_Proc := null;
+ Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null;
+ Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null;
+ -- GNAT
+ -- These three locations are left null when operating in non-compiler (e.g.
+ -- ASIS mode), but when operating in compiler mode, they are set to point
+ -- to the three corresponding procedures in Osint-C. The reason for this
+ -- slightly strange interface is to stop Repinfo from dragging in Osint in
+ -- ASIS mode, which would include lots of unwanted units in the ASIS build.
+
+ type Create_List_File_Proc is access procedure (S : String);
+ type Write_List_Info_Proc is access procedure (S : String);
+ type Close_List_File_Proc is access procedure;
+ -- Types used for procedure addresses below
+
+ Create_List_File_Access : Create_List_File_Proc := null;
+ Write_List_Info_Access : Write_List_Info_Proc := null;
+ Close_List_File_Access : Close_List_File_Proc := null;
-- GNAT
-- These three locations are left null when operating in non-compiler
- -- (e.g. ASIS mode), but when operating in compiler mode, they are
- -- set to point to the three corresponding procedures in Osint. The
+ -- (e.g. from the binder), but when operating in compiler mode, they are
+ -- set to point to the three corresponding procedures in Osint-C. The
-- reason for this slightly strange interface is to prevent Repinfo
- -- from dragging in Osint in ASIS mode, which would include a lot of
- -- unwanted units in the ASIS build.
+ -- from dragging in Osint-C in the binder, which would include unwanted
+ -- units in the binder.
Locking_Policy : Character := ' ';
-- GNAT, GNATBIND
- -- Set to ' ' for the default case (no locking policy specified).
- -- Reset to first character (uppercase) of locking policy name if a
- -- valid pragma Locking_Policy is encountered.
+ -- Set to ' ' for the default case (no locking policy specified). Reset to
+ -- first character (uppercase) of locking policy name if a valid pragma
+ -- Locking_Policy is encountered.
Locking_Policy_Sloc : Source_Ptr := No_Location;
-- GNAT, GNATBIND
- -- Remember location of previous Locking_Policy pragma. This is used
- -- for inconsistency error messages. A value of System_Location is
- -- used if the policy is set in package System.
+ -- Remember location of previous Locking_Policy pragma. This is used for
+ -- inconsistency error messages. A value of System_Location is used if the
+ -- policy is set in package System.
Look_In_Primary_Dir : Boolean := True;
-- GNAT, GNATBIND, GNATMAKE, GNATCLEAN
- -- Set to False if a -I- was present on the command line.
- -- When True we are allowed to look in the primary directory to locate
- -- other source or library files.
+ -- Set to False if a -I- was present on the command line. When True we are
+ -- allowed to look in the primary directory to locate other source or
+ -- library files.
Make_Steps : Boolean := False;
-- GNATMAKE
-- File name of mapping between unit names, file names and path names.
-- (given by switch -gnatem)
- Maximum_Errors : Int := 9999;
+ Maximum_Messages : Int := 9999;
-- GNAT, GNATBIND
- -- Maximum default number of errors before compilation is terminated.
- -- Can be overridden using -gnatm (GNAT) or -m (GNATBIND) switch.
+ -- Maximum default number of errors before compilation is terminated, or in
+ -- the case of GNAT, maximum number of warnings before further warnings are
+ -- suppressed. Can be overridden by -gnatm (GNAT) or -m (GNATBIND) switch.
Maximum_File_Name_Length : Int;
-- GNAT, GNATBIND
-- extension, as set by the appropriate switch. If no switch is given,
-- then this value is initialized by Osint to the appropriate value.
- Max_Line_Length : Int := Hostparm.Max_Line_Length;
- -- This is a copy of Max_Line_Length used by the scanner. It is usually
- -- set to be a copy of Hostparm.Max_Line_Length, and is used to check
- -- the maximum line length in the scanner when style checking is inactive.
- -- The only time it is set to a different value is during the scanning of
- -- configuration pragma files, where we want to turn off all checking and
- -- in particular we want to allow long lines. So we reset this value to
- -- Column_Number'Last during scanning of configuration pragma files.
-
Maximum_Processes : Positive := 1;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE, GPRBUILD
-- Maximum number of processes that should be spawned to carry out
-- compilations.
-- GNATMAKE
-- Set to True if minimal recompilation mode requested
+ Special_Exception_Package_Used : Boolean := False;
+ -- GNAT
+ -- Set to True if either of the unit GNAT.Most_Recent_Exception or
+ -- GNAT.Exception_Traces is with'ed. Used to inhibit transformation of
+ -- local raise statements into gotos in the presence of either package.
+
Multiple_Unit_Index : Int;
-- GNAT
-- This is set non-zero if the current unit is being compiled in multiple
-- This flag is set True if a No_Run_Time pragma is encountered. See
-- spec of Rtsfind for a full description of handling of this pragma.
+ No_Split_Units : Boolean := False;
+ -- GPRBUILD
+ -- Set to True with switch --no-split-units. When True, unit sources, spec,
+ -- body and subunits, must all be in the same project.This is checked after
+ -- each compilation.
+
No_Stdinc : Boolean := False;
-- GNAT, GNATBIND, GNATMAKE, GNATFIND, GNATXREF
-- Set to True if no default source search dirs added to search list
-- error is detected then this flag is reset from Generate_Code to
-- Check_Semantics after generating an error message.
+ Optimize_Alignment : Character := 'O';
+ -- Setting of Optimize_Alignment, set to T/S/O for time/space/off. Can
+ -- be modified by use of pragma Optimize_Alignment.
+
+ Optimize_Alignment_Local : Boolean := False;
+ -- Set True if Optimize_Alignment mode is set by a local configuration
+ -- pragma that overrides the gnat.adc (or other configuration file) default
+ -- so that the unit is not dependent on the default setting. Also always
+ -- set True for internal units, since these always have a default setting
+ -- of Optimize_Alignment (Off) that is enforced (essentially equivalent to
+ -- them all having such an explicit pragma in each unit).
+
Original_Operating_Mode : Operating_Mode_Type := Generate_Code;
-- GNAT
- -- Indicates the original operating mode of the compiler as set by
- -- compiler options. This is identical to Operating_Mode except that
- -- this is not affected by errors.
+ -- Indicates the original operating mode of the compiler as set by compiler
+ -- options. This is identical to Operating_Mode except that this is not
+ -- affected by errors.
Optimization_Level : Int;
pragma Import (C, Optimization_Level, "optimize");
- -- This constant reflects the optimization level (0,1,2 for -O0,-O1,-O2)
+ -- Constant reflecting the optimization level (0,1,2,3 for -O0,-O1,-O2,-O3)
+ -- See jmissing.c and aamissing.c for definitions for dotnet/jgnat and
+ -- GNAAMP back ends.
+
+ Optimize_Size : Int;
+ pragma Import (C, Optimize_Size, "optimize_size");
+ -- Constant reflecting setting of -Os (optimize for size). Set to nonzero
+ -- in -Os mode and set to zero otherwise. See jmissing.c and aamissing.c
+ -- for definitions of "optimize_size" for dotnet/jgnat and GNAAMP backends
Output_File_Name_Present : Boolean := False;
- -- GNATBIND, GNAT, GNATMAKE
- -- Set to True when the output C file name is given with option -o
- -- for GNATBIND, when the object file name is given with option
- -- -gnatO for GNAT or when the executable is given with option -o
- -- for GNATMAKE.
+ -- GNATBIND, GNAT, GNATMAKE, GPRMAKE
+ -- Set to True when the output C file name is given with option -o for
+ -- GNATBIND, when the object file name is given with option -gnatO for GNAT
+ -- or when the executable is given with option -o for GNATMAKE or GPRMAKE.
Output_Linker_Option_List : Boolean := False;
-- GNATBIND
-- GNATBIND
-- True if output of list of objects is requested (-O switch set)
+ Overflow_Checks_Unsuppressed : Boolean := False;
+ -- GNAT
+ -- Set to True if at least one occurrence of pragma Unsuppress
+ -- (All_Checks|Overflow_Checks) has been processed.
+
Persistent_BSS_Mode : Boolean := False;
-- GNAT
-- True if a Persistent_BSS configuration pragma is in effect, causing
Preprocessing_Data_File : String_Ptr := null;
-- GNAT
- -- Set by switch -gnatep=. The file name of the prepocessing data file.
+ -- Set by switch -gnatep=. The file name of the preprocessing data file.
Print_Generated_Code : Boolean := False;
-- GNAT
type Usage is (Unknown, Not_In_Use, In_Use);
Project_File_In_Use : Usage := Unknown;
-- GNAT
- -- Indicates if a project file is used or not.
- -- Set to In_Use by the first SFNP pragma.
+ -- Indicates if a project file is used or not. Set to In_Use by the first
+ -- SFNP pragma.
Queuing_Policy : Character := ' ';
-- GNAT, GNATBIND
- -- Set to ' ' for the default case (no queuing policy specified).
- -- Reset to first character (uppercase) of locking policy name if a valid
+ -- Set to ' ' for the default case (no queuing policy specified). Reset to
+ -- first character (uppercase) of locking policy name if a valid
-- Queuing_Policy pragma is encountered.
Queuing_Policy_Sloc : Source_Ptr := No_Location;
-- GNAT, GNATBIND
- -- Remember location of previous Queuing_Policy pragma. This is used
- -- for inconsistency error messages. A value of System_Location is
- -- used if the policy is set in package System.
+ -- Remember location of previous Queuing_Policy pragma. This is used for
+ -- inconsistency error messages. A value of System_Location is used if the
+ -- policy is set in package System.
Quiet_Output : Boolean := False;
- -- GNATMAKE, GNATCLEAN, GPR2MAKE
+ -- GNATMAKE, GNATCLEAN, GPRMAKE, GPRBUILD, GPRCLEAN
-- Set to True if the tool should not have any output if there are no
-- errors or warnings.
+ Replace_In_Comments : Boolean := False;
+ -- GNATPREP
+ -- Set to True if -C switch used
+
RTS_Lib_Path_Name : String_Ptr := null;
RTS_Src_Path_Name : String_Ptr := null;
-- GNAT
-- GNATMAKE, GNATLINK
-- Set to False when no run_path_option should be issued to the linker
+ Search_Directory_Present : Boolean := False;
+ -- GNAT
+ -- Set to True when argument is -I. Reset to False when next argument, a
+ -- search directory path is taken into account. Note that this is quite
+ -- different from other switches in this section in that it is only set in
+ -- a transitory manner as a result of scanning a -I switch with no file
+ -- name, and if set, is an indication that the next argument is to be
+ -- treated as a file name.
+
Sec_Stack_Used : Boolean := False;
-- GNAT, GBATBIND
- -- Set True if generated code uses the System.Secondary_Stack package.
- -- For the binder, set if any unit uses the secondary stack package.
+ -- Set True if generated code uses the System.Secondary_Stack package. For
+ -- the binder, set if any unit uses the secondary stack package.
Setup_Projects : Boolean := False;
-- GNAT DRIVER
Shared_Libgnat : Boolean;
-- GNATBIND
- -- Set to True if a shared libgnat is requested by using the -shared
- -- option for GNATBIND and to False when using the -static option. The
- -- value of this flag is set by Gnatbind.Scan_Bind_Arg.
+ -- Set to True if a shared libgnat is requested by using the -shared option
+ -- for GNATBIND and to False when using the -static option. The value of
+ -- this flag is set by Gnatbind.Scan_Bind_Arg.
+
+ Short_Circuit_And_Or : Boolean := False;
+ -- GNAT
+ -- Set True if a pragma Short_Circuit_And_Or applies to the current unit.
+
+ Sprint_Line_Limit : Nat := 72;
+ -- Limit values for chopping long lines in Sprint output, can be reset
+ -- by use of NNN parameter with -gnatG or -gnatD switches.
Stack_Checking_Enabled : Boolean;
-- GNAT
Style_Check : Boolean := False;
-- GNAT
- -- Set True to perform style checks. Activates checks carried out
- -- in package Style (see body of this package for details of checks)
- -- This flag is set True by either the -gnatg or -gnaty switches.
+ -- Set True to perform style checks. Activates checks carried out in
+ -- package Style (see body of this package for details of checks) This
+ -- flag is set True by either the -gnatg or -gnaty switches.
+
+ Suppress_All_Inlining : Boolean := False;
+ -- GNAT
+ -- Set by -fno-inline. Suppresses all inlining, both front end and back end
+ -- regardless of any other switches that are set.
+
+ Suppress_Control_Flow_Optimizations : Boolean := False;
+ -- GNAT
+ -- Set by -fpreserve-control-flow. Suppresses control flow optimizations
+ -- that interfere with coverage analysis based on the object code.
System_Extend_Pragma_Arg : Node_Id := Empty;
-- GNAT
-- multiplied by the factor given here. The default value is used if no
-- -gnatT switch appears.
+ Tagged_Type_Expansion : Boolean := True;
+ -- GNAT
+ -- Set True if tagged types and interfaces should be expanded by the
+ -- front-end. If False, the original tree is left unexpanded for tagged
+ -- types and dispatching calls, assuming the underlying target supports
+ -- it (e.g. in the JVM case).
+
Task_Dispatching_Policy : Character := ' ';
-- GNAT, GNATBIND
-- Set to ' ' for the default case (no task dispatching policy specified).
-- Tolerate time stamp and other consistency errors. If this flag is set to
-- True (-t), then inconsistencies result in warnings rather than errors.
+ Treat_Restrictions_As_Warnings : Boolean := False;
+ -- GNAT
+ -- Set True to treat pragma Restrictions as Restriction_Warnings. Set by
+ -- -gnatr switch.
+
Tree_Output : Boolean := False;
-- GNAT
-- Set to True (-gnatt) to generate output tree file
+ True_VMS_Target : Boolean := False;
+ -- Set True if we are on a VMS target. The setting of this flag reflects
+ -- the true state of the compile, unlike Targparm.OpenVMS_On_Target which
+ -- can also be true when debug flag m is set (-gnatdm). This is used in the
+ -- few cases where we do NOT want -gnatdm to trigger the VMS behavior.
+
Try_Semantics : Boolean := False;
-- GNAT
-- Flag set to force attempt at semantic analysis, even if parser errors
-- the other hand, most such blowups will be caught cleanly and simply
-- say compilation abandoned. This flag is set to True by -gnatq or -gnatQ.
+ Unchecked_Shared_Lib_Imports : Boolean := False;
+ -- GPRBUILD
+ -- Set to True when shared library projects are allowed to import projects
+ -- that are not shared library projects. Set by switch
+ -- --unchecked-shared-lib-imports.
+
Undefined_Symbols_Are_False : Boolean := False;
-- GNAT, GNATPREP
-- Set to True by switch -u of gnatprep or -u in the preprocessing data
-- corresponding attribute set in GNATBIND.
Upper_Half_Encoding : Boolean := False;
- -- GNAT
- -- Normally set False, indicating that upper half ASCII characters are
+ -- GNAT, GNATBIND
+ -- Normally set False, indicating that upper half ISO 8859-1 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.
+ -- a wide character sequence. Set by -gnatW or -W switches.
Usage_Requested : Boolean := False;
-- GNAT, GNATBIND, GNATMAKE
-- 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
+ -- defined by the switches in package Validsw. 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, GNATNAME, GNATCLEAN
+ -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN,
+ -- GPRMAKE, GPRBUILD, GPRCLEAN
-- Set to True to get verbose mode (full error message text and location
-- information sent to standard output, also header, copyright and summary)
+ type Verbosity_Level_Type is (None, Low, Medium, High);
+ Verbosity_Level : Verbosity_Level_Type := High;
+ -- GNATMAKE, GPRMAKE
+ -- Modified by gnatmake or gprmake switches -v, -vl, -vm, -vh. Indicates
+ -- the level of verbosity of informational messages:
+ --
+ -- In Low Verbosity, the reasons why a source is recompiled, the name
+ -- of the executable and the reason it must be rebuilt is output.
+ --
+ -- In Medium Verbosity, additional lines are output for each ALI file
+ -- that is checked.
+ --
+ -- In High Verbosity, additional lines are output when the ALI file
+ -- is part of an Ada library, is read-only or is part of the runtime.
+
Warn_On_Ada_2005_Compatibility : Boolean := True;
-- GNAT
- -- Set to True to active all warnings on Ada 2005 compatibility issues,
+ -- Set to True to generate 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_Parameter_Order : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings for cases where the argument list for
+ -- a call is a sequence of identifiers that match the formal identifiers,
+ -- but are in the wrong order.
+
+ Warn_On_Assertion_Failure : Boolean := True;
+ -- GNAT
+ -- Set to True to activate warnings on assertions that can be determined
+ -- at compile time will always fail. Set false by -gnatw.A.
+
+ Warn_On_Assumed_Low_Bound : Boolean := True;
+ -- GNAT
+ -- Set to True to activate warnings for string parameters that are indexed
+ -- with literals or S'Length, presumably assuming a lower bound of one. Set
+ -- False by -gnatwW.
+
Warn_On_Bad_Fixed_Value : Boolean := False;
-- GNAT
-- Set to True to generate warnings for static fixed-point expression
-- values that are not an exact multiple of the small value of the type.
+ Warn_On_Biased_Representation : Boolean := True;
+ -- GNAT
+ -- Set to True to generate warnings for size clauses, component clauses
+ -- and component_size clauses that force biased representation. Set False
+ -- by -gnatw.B.
+
Warn_On_Constant : Boolean := False;
-- GNAT
-- Set to True to generate warnings for variables that could be declared
-- as constants. Modified by use of -gnatwk/K.
+ Warn_On_Deleted_Code : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings for code deleted by the front end
+ -- for conditional statements whose outcome is known at compile time.
+ -- Modified by use of -gnatwt/T.
+
Warn_On_Dereference : Boolean := False;
-- GNAT
-- Set to True to generate warnings for implicit dereferences for array
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.
+ -- read. Also controls warnings for similar cases involving out parameters,
+ -- but only if there is only one out parameter for the procedure involved.
+ -- The default is that this warning is suppressed.
+
+ Warn_On_All_Unread_Out_Parameters : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings in all cases where a variable is
+ -- modified by being passed as to an OUT formal, but the resulting value is
+ -- never read. The default is that this warning is suppressed, except in
+ -- the case of
Warn_On_No_Value_Assigned : Boolean := True;
-- GNAT
-- variable that is at least partially uninitialized. Set to false to
-- suppress such warnings. The default is that such warnings are enabled.
+ Warn_On_Non_Local_Exception : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings for non-local exception raises and also
+ -- handlers that can never handle a local raise. This warning is only ever
+ -- generated if pragma Restrictions (No_Exception_Propagation) is set. The
+ -- default is not to generate the warnings except that if the source has
+ -- at least one exception handler, and this restriction is set, and the
+ -- warning was not explicitly turned off, then it is turned on by default.
+
+ No_Warn_On_Non_Local_Exception : Boolean := False;
+ -- GNAT
+ -- This is set to True if the above warning is explicitly suppressed. We
+ -- use this to avoid turning it on by default when No_Exception_Propagation
+ -- restriction is set and an exception handler is present.
+
Warn_On_Obsolescent_Feature : Boolean := False;
-- GNAT
-- 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_Overlap : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings when a writable actual which is not
+ -- a by-copy type overlaps with another actual in a subprogram call.
+
+ Warn_On_Questionable_Missing_Parens : Boolean := True;
+ -- GNAT
+ -- Set to True to generate warnings for cases where parentheses are missing
+ -- and the usage is questionable, because the intent is unclear.
+
Warn_On_Redundant_Constructs : Boolean := False;
-- GNAT
-- Set to True to generate warnings for redundant constructs (e.g. useless
-- assignments/conversions). The default is that this warning is disabled.
+ Warn_On_Object_Renames_Function : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings when a function result is renamed as
+ -- an object. The default is that this warning is disabled.
+
+ Warn_On_Reverse_Bit_Order : Boolean := True;
+ -- GNAT
+ -- Set to True to generate warning (informational) messages for component
+ -- clauses that are affected by non-standard bit-order. The default is
+ -- that this warning is enabled.
+
+ Warn_On_Suspicious_Modulus_Value : Boolean := True;
+ -- GNAT
+ -- Set to True to generate warnings for suspicious modulus values. The
+ -- default is that this warning is enabled.
+
Warn_On_Unchecked_Conversion : Boolean := True;
-- GNAT
-- Set to True to generate warnings for unchecked conversions that may have
-- Set to True to generate warnings for unrecognized pragmas. The default
-- is that this warning is enabled.
+ Warn_On_Unrepped_Components : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings for the case of components of record
+ -- which have a record representation clause but this component does not
+ -- have a component clause. The default is that this warning is disabled.
+
+ Warn_On_Warnings_Off : Boolean := False;
+ -- GNAT
+ -- Set to True to generate warnings for use of Pragma Warnings (Off, ent),
+ -- where either the pragma is never used, or it could be replaced by a
+ -- pragma Unmodified or Unreferenced.
+
type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
Warning_Mode : Warning_Mode_Type := Normal;
-- GNAT, GNATBIND
-- are generated and are treated as errors.
Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets;
- -- GNAT
+ -- GNAT, GNATBIND
-- Method used for encoding wide characters in the source program. See
-- description of type in unit System.WCh_Con for a list of the methods
-- that are currently supported. Note that brackets notation is always
-- 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.
+ -- the default for encoding [Wide_[Wide_]]Text_IO files. For the binder,
+ -- the value set here overrides this main unit default.
+
+ Wide_Character_Encoding_Method_Specified : Boolean := False;
+ -- GNAT, GNATBIND
+ -- Set True if the value in Wide_Character_Encoding_Method was set as
+ -- a result of an explicit -gnatW? or -W? switch. False otherwise.
Xref_Active : Boolean := True;
-- GNAT
-- Set if cross-referencing is enabled (i.e. xref info in ALI files)
+ Zero_Formatting : Boolean := False;
+ -- GNATBIND
+ -- Do no formatting (no title, no leading spaces, no empty lines) in
+ -- auxiliary outputs (-e, -K, -l, -R).
+
----------------------------
-- 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.
+ -- line switches, or by the use of appropriate configuration pragmas in a
+ -- configuration pragma file.
Ada_Version_Config : Ada_Version_Type;
-- GNAT
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.
+ -- This is set in the same manner as Ada_Version_Config. The difference is
+ -- that the setting of this flag is not ignored for internal and predefined
+ -- units, which for some purposes do indeed access this value, regardless
+ -- of the fact that they are compiled the most up to date ada version).
Assertions_Enabled_Config : Boolean;
-- GNAT
-- mode, as possibly set by the command line switch -gnata, and possibly
-- modified by the use of the configuration pragma Assertion_Policy.
+ Assume_No_Invalid_Values_Config : Boolean;
+ -- GNAT
+ -- This is the value of the configuration switch for assuming "no invalid
+ -- values enabled" mode, as possibly set by the command line switch
+ -- -gnatB, and possibly modified by the use of the configuration pragma
+ -- Assume_No_Invalid_Values.
+
+ Check_Policy_List_Config : Node_Id;
+ -- GNAT
+ -- This points to the list of N_Pragma nodes for Check_Policy pragmas
+ -- that are linked through the Next_Pragma fields, with the list being
+ -- terminated by Empty. The order is most recently processed first. This
+ -- list includes only those pragmas in configuration pragma files.
+
Debug_Pragmas_Enabled_Config : Boolean;
-- GNAT
-- This is the value of the configuration switch for debug pragmas enabled
-- however that the setting of this flag is ignored for internal and
-- predefined units (which are always compiled with Lowercase mode).
+ Fast_Math_Config : Boolean;
+ -- GNAT
+ -- This is the value of the configuration switch that controls Fast_Math
+ -- mode, as set by a Fast_Math pragma in configuration pragmas. It is
+ -- used to set the initial value of Fast_Math at the start of each new
+ -- compilation unit.
+
+ Init_Or_Norm_Scalars_Config : Boolean;
+ -- GNAT
+ -- This is the value of the configuration switch that is set by one
+ -- of the pragmas Initialize_Scalars or Normalize_Scalars.
+
+ Initialize_Scalars_Config : Boolean;
+ -- GNAT
+ -- This is the value of the configuration switch that is set by the
+ -- pragma Initialize_Scalars when it appears in the gnat.adc file.
+ -- This switch is not set when the pragma appears ahead of a given
+ -- unit, so it does not affect the compilation of other units.
+
+ Optimize_Alignment_Config : Character;
+ -- GNAT
+ -- This is the value of the configuration switch that controls the
+ -- alignment optimization mode, as set by an Optimize_Alignment pragma.
+ -- It is used to set the initial value of Optimize_Alignment at the start
+ -- of each new compilation unit, except that it is always set to 'O' (off)
+ -- for internal units.
+
Persistent_BSS_Mode_Config : Boolean;
-- GNAT
-- This is the value of the configuration switch that controls whether
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
+ -- VADS_Size instead of Size wherever 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
-- parameter Internal_Unit is True for an internal or predefined unit, and
-- affects the way the switches are set (see above). Main_Unit is true if
-- switches are being set for the main unit (this affects setting of the
- -- assert/debug pragm switches, which are normally set false by default for
- -- an internal unit, except when the internal unit is the main unit, in
- -- which case we use the command line settings).
+ -- assert/debug pragma switches, which are normally set false by default
+ -- for an internal unit, except when the internal unit is the main unit,
+ -- in which case we use the command line settings).
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.
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.
+ -- This procedure is called after processing the gnat.adc file and other
+ -- configuration pragma files to record the values of the Config switches,
+ -- as possibly modified by the use of command line switches and pragmas
+ -- appearing in these files.
------------------------
-- Other Global Flags --
-- be in the spec of Expander, but it is referenced by Errout, and it
-- really seems wrong for Errout to depend on Expander.
+ Static_Dispatch_Tables : Boolean := True;
+ -- This flag indicates if the backend supports generation of statically
+ -- allocated dispatch tables. If it is True, then the front end will
+ -- generate static aggregates for dispatch tables that contain forward
+ -- references to addresses of subprograms not seen yet, and the back end
+ -- must be prepared to handle this case. If it is False, then the front
+ -- end generates assignments to initialize the dispatch table, and there
+ -- are no such forward references. By default we build statically allocated
+ -- dispatch tables for all library level tagged types in all platforms.This
+ -- behavior can be disabled using switch -gnatd.t which will set this flag
+ -- to False and revert to the previous dynamic behavior.
+
-----------------------
-- Tree I/O Routines --
-----------------------
-- They are set by Tree_Read procedure, so they represent the version
-- number (and the version string) of the compiler which has created the
-- tree, and they are supposed to be compared with the corresponding values
- -- from the Gnatvsn package which is a part of ASIS implementation.
+ -- from the Tree_IO and Gnatvsn packages which also are a part of ASIS
+ -- implementation.
- Tree_Version_String : String (Gnat_Version_String'Range);
+ Tree_Version_String : String_Access;
-- 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.
+ -- if it is from the same date as stored in the version string in Gnatvsn.
+ -- We require that ASIS Pro can be used only with GNAT Pro, but we allow
+ -- non-Pro ASIS and ASIS-based tools to be used with any version of the
+ -- GNAT compiler. Therefore, we need the possibility to compare the dates
+ -- of the corresponding source sets, using version strings that may be
+ -- of different lengths.
Tree_ASIS_Version_Number : Int;
-- Used to store the ASIS version number read from a tree file to check if
- -- it is the same as stored in the ASIS version number in Gnatvsn.
+ -- it is the same as stored in the ASIS version number in Tree_IO.
private
+ -- The following type is used to save and restore settings of switches in
+ -- Opt that represent the configuration (i.e. result of config pragmas).
+
+ -- Note that Ada_Version_Explicit is not included, since this is a sticky
+ -- flag that once set does not get reset, since the whole idea of this flag
+ -- is to record the setting for the main unit.
+
type Config_Switches_Type is record
Ada_Version : Ada_Version_Type;
Ada_Version_Explicit : Ada_Version_Type;
Assertions_Enabled : Boolean;
+ Assume_No_Invalid_Values : Boolean;
+ Check_Policy_List : Node_Id;
Debug_Pragmas_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;
+ Fast_Math : Boolean;
+ Init_Or_Norm_Scalars : Boolean;
+ Initialize_Scalars : Boolean;
+ Optimize_Alignment : Character;
+ Optimize_Alignment_Local : Boolean;
Persistent_BSS_Mode : Boolean;
Polling_Required : Boolean;
Use_VADS_Size : Boolean;
end record;
+ -- The following declarations are for GCC version dependent flags. We do
+ -- not let client code in the compiler test GCC_Version directly, but
+ -- instead use deferred constants for relevant feature tags.
+
+ -- Note: there currently are no such constants defined in this section,
+ -- since the compiler front end is currently entirely independent of the
+ -- GCC version, which is a desirable state of affairs.
+
+ function get_gcc_version return Int;
+ pragma Import (C, get_gcc_version, "get_gcc_version");
+
+ GCC_Version : constant Nat := get_gcc_version;
+ -- GNATMAKE
+ -- Indicates which version of gcc is in use (3 = 3.x, 4 = 4.x). Note that
+ -- gcc 2.8.1 (which used to be a value of 2) is no longer supported.
+
end Opt;