-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, 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- --
-- other GNAT tools. The comments indicate which options are used by which
-- 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 Debug;
with Hostparm; use Hostparm;
with Types; use Types;
-- 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.
-- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
Bind_Only : Boolean := False;
- -- GNATMAKE, GPRMAKE
+ -- 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, GPRMAKE
+ -- GNATMAKE, GPRMAKE, GPBUILD
-- Set to True to check compiler options during the make process
Check_Unreferenced : Boolean := False;
-- in the output file.
Compile_Only : Boolean := False;
- -- GNATMAKE, GNATCLEAN, GPRMAKE
- -- GNATMAKE, GPRMAKE: 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
-- potentially blocking operations are detected from protected actions.
Display_Compilation_Progress : Boolean := False;
- -- GNATMAKE, GPRMAKE
+ -- 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).
-- 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 -gnatLnnn.
+ -- multiple lines not exceeding the specified length. Set by -gnatj=nn.
Exception_Locations_Suppressed : Boolean := False;
-- GNAT
-- 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, GPRMAKE
+ -- 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, GPRMAKE
+ -- 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
Generating_Code : Boolean := False;
-- GNAT
-- True if the frontend finished its work and has called the backend to
- -- processs the tree and generate the object file.
+ -- process the tree and generate the object file.
Global_Discard_Names : Boolean := False;
-- GNAT, GNATBIND
-- then elaboration flag checks are to be generated in the binder
-- generated file.
- Follow_Links : Boolean := False;
- -- GNATMAKE
+ Inspector_Mode : Boolean renames Debug.Debug_Flag_Dot_II;
+ -- GNAT
+ -- True if compiling in inspector mode (-gnatd.I switch).
+ -- Only relevant when VM_Target /= None. The compiler will attempt to
+ -- generate code even in case of unsupported construct, so that the byte
+ -- code can be used by static analysis tools.
+
+ 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 := True;
+ -- PROJECT MANAGER
+ -- Whether directories can be links in this project, and therefore
+ -- additional system calls should be performed to ensure we always see the
+ -- same full name for each directory.
Front_End_Inlining : Boolean := False;
-- GNAT
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, GPRMAKE
+ -- GNATMAKE, GPRMAKE, GPRBUILD
-- When True signals to ignore compilation errors and keep
-- processing sources until there is no more work.
-- children.
Link_Only : Boolean := False;
- -- GNATMAKE, GPRMAKE
+ -- GNATMAKE, GPRMAKE, GPRBUILD
-- Set to True to skip compile and bind steps
-- (except when Bind_Only is set to True).
-- then this value is initialized by Osint to the appropriate value.
Maximum_Processes : Positive := 1;
- -- GNATMAKE, GPRMAKE
+ -- GNATMAKE, GPRMAKE, GPRBUILD
-- Maximum number of processes that should be spawned to carry out
-- compilations.
-- 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
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)
Output_File_Name_Present : Boolean := False;
-- GNATBIND, GNAT, GNATMAKE, GPRMAKE
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
-- used if the policy is set in package System.
Quiet_Output : Boolean := False;
- -- GNATMAKE, GNATCLEAN, GPRMAKE
+ -- GNATMAKE, GNATCLEAN, GPRMAKE, GPRBUILD, GPRCLEAN
-- Set to True if the tool should not have any output if there are no
-- errors or warnings.
-- 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.
+
System_Extend_Pragma_Arg : Node_Id := Empty;
-- GNAT
-- Set non-empty if and only if a correct Extend_System pragma was present
-- 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
-- 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
Verbose_Mode : Boolean := False;
-- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN,
- -- GPRMAKE
+ -- 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)
-- 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
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. Also controls
- -- warnings about assignments whose value is never read.
+ -- 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
Warn_On_Questionable_Missing_Parens : Boolean := True;
-- GNAT
- -- Set to True to generate warnings for cases where parenthese are missing
+ -- 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;
-- 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
-- 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
-- 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 the most up to date ada version).
+ -- 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.
+ 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.
+
+ 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
-- 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 --
-- 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_Access;
-- Used to store the compiler version string read from a tree file to check
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
Ada_Version : Ada_Version_Type;
Ada_Version_Explicit : Ada_Version_Type;
Assertions_Enabled : 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;
+ Optimize_Alignment : Character;
+ Optimize_Alignment_Local : Boolean;
Persistent_BSS_Mode : Boolean;
Polling_Required : Boolean;
Use_VADS_Size : Boolean;