1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
36 -- This package contains global switches set by the initialization
37 -- routine from the command line and referenced throughout the compiler,
38 -- the binder or gnatmake. The comments indicate which options are used by
39 -- which programs (GNAT, GNATBIND, GNATMAKE).
41 with Hostparm
; use Hostparm
;
42 with Types
; use Types
;
43 with System
.WCh_Con
; use System
.WCh_Con
;
47 ----------------------------------------------
48 -- Settings of Modes for Current Processing --
49 ----------------------------------------------
51 -- The following mode values represent the current state of processing.
52 -- The values set here are the default values. Unless otherwise noted,
53 -- the value may be reset in Switch with an appropropiate switch. In
54 -- some cases, the values can also be modified by pragmas, and in the
55 -- case of some binder variables, Gnatbind.Scan_Bind_Arg may modify
56 -- the default values.
58 Ada_Bind_File
: Boolean := True;
60 -- Set True if binder file to be generated in Ada rather than C
62 Ada_95
: Boolean := True;
64 -- Set True if operating in Ada 95 mode
65 -- Set False if operating in Ada 83 mode
67 Ada_83
: Boolean := False;
69 -- Set True if operating in Ada 83 mode
70 -- Set False if operating in Ada 95 mode
72 Ada_Final_Suffix
: constant String := "final";
74 -- The suffix of the name of the finalization procedure. This variable
75 -- may be modified by Gnatbind.Scan_Bind_Arg.
77 Ada_Final_Name
: String_Ptr
:= new String'("ada" & Ada_Final_Suffix);
79 -- The name of the procedure that performs the finalization at the end of
80 -- execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
82 Ada_Init_Suffix : constant String := "init";
84 -- The suffix of the name of the initialization procedure. This variable
85 -- may be modified by Gnatbind.Scan_Bind_Arg.
87 Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix
);
89 -- The name of the procedure that performs initialization at the start
90 -- of execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
92 Ada_Main_Name_Suffix
: constant String := "main";
94 -- The suffix for Ada_Main_Name. Defined as a constant here so that it
95 -- can be referenced in a uniform manner to create either the default
96 -- value of Ada_Main_Name (declared below), or the non-default name
97 -- set by Gnatbind.Scan_Bind_Arg.
99 Ada_Main_Name
: String_Ptr
:= new String'("ada_" & Ada_Main_Name_Suffix);
101 -- The name of the Ada package generated by the binder (when in Ada mode).
102 -- This variable may be modified by Gnatbind.Scan_Bind_Arg.
104 Address_Clause_Overlay_Warnings : Boolean := True;
106 -- Set False to disable address clause warnings
108 All_Errors_Mode : Boolean := False;
110 -- Flag set to force display of multiple errors on a single line and
111 -- also repeated error messages for references to undefined identifiers
112 -- and certain other repeated error messages.
114 All_Sources : Boolean := False;
116 -- Set to True to require all source files to be present. This flag is
117 -- directly modified by gnatmake to affect the shared binder routines.
119 Alternate_Main_Name : String_Ptr := null;
120 -- Set to non null when Bind_Alternate_Main_Name is True. This value
121 -- is modified as needed by Gnatbind.Scan_Bind_Arg.
123 Assertions_Enabled : Boolean := False;
125 -- Enable assertions made using pragma Assert.
127 Back_Annotate_Rep_Info : Boolean := False;
129 -- If set True (by use of -gnatB), enables back annotation of
130 -- representation information by gigi, even in -gnatc mode.
132 Bind_Alternate_Main_Name : Boolean := False;
134 -- Set to True if main should be called Alternate_Main_Name.all. This
135 -- variable may be set to True by Gnatbind.Scan_Bind_Arg.
137 Bind_Main_Program : Boolean := True;
139 -- Set to False if not binding main Ada program.
141 Bind_For_Library : Boolean := False;
143 -- Set to True if the binder needs to generate a file designed for
144 -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
146 Bind_Only : Boolean := False;
148 -- Set to True to skip compile and link steps
149 -- (except when Compile_Only and/or Link_Only are True).
151 Brief_Output : Boolean := False;
153 -- Force brief error messages to standard error, even if verbose mode is
154 -- set (so that main error messages go to standard output).
156 Check_Object_Consistency : Boolean := False;
157 -- GNATBIND, GNATMAKE
158 -- Set to True to check whether every object file is consistent with
159 -- with its corresponding ada library information (ali) file. An object
160 -- file is inconsistent with the corresponding ali file if the object
161 -- file does not exist or if it has an older time stamp than the ali file.
162 -- Default above is for GNATBIND. GNATMAKE overrides this default to
163 -- True (see Make.Initialize) since we do not need to check source
164 -- consistencies in gnatmake in this sense.
166 Check_Only : Boolean := False;
168 -- Set to True to do checks only, no output of binder file.
170 Check_Readonly_Files : Boolean := False;
172 -- Set to True to check readonly files during the make process.
174 Check_Source_Files : Boolean := True;
176 -- Set to True to enable consistency checking for any source files that
177 -- are present (i.e. date must match the date in the library info file).
178 -- Set to False for object file consistency check only. This flag is
179 -- directly modified by gnatmake, to affect the shared binder routines.
181 Check_Switches : Boolean := False;
183 -- Set to True to check compiler options during the make process.
185 Check_Unreferenced : Boolean := False;
187 -- Set to True to enable checking for unreferenced variables
189 Check_Withs : Boolean := False;
191 -- Set to True to enable checking for unused withs, and also the case
192 -- of withing a package and using none of the entities in the package.
194 Compile_Only : Boolean := False;
196 -- Set to True to skip bind and link steps (except when Bind_Only is True)
198 Compress_Debug_Names : Boolean := False;
200 -- Set to True if the option to compress debug information is set (-gnatC)
202 Config_File : Boolean := True;
204 -- Set to False to inhibit reading and processing of gnat.adc file
206 Config_File_Name : String_Ptr := null;
208 -- File name of configuration pragmas file (given by switch -gnatec)
210 Constant_Condition_Warnings : Boolean := False;
212 -- Set to True to activate warnings on constant conditions
214 subtype Debug_Level_Value is Nat range 0 .. 3;
215 Debugger_Level : Debug_Level_Value := 0;
217 -- The value given to the -g parameter.
218 -- The default value for -g with no value is 2
219 -- This is usually ignored by GNATBIND, except in the VMS version
220 -- where it is passed as an argument to __gnat_initialize to trigger
221 -- the activation of the remote debugging interface (is this true???).
223 Debug_Generated_Code : Boolean := False;
225 -- Set True (-gnatD switch) to debug generated expanded code instead
226 -- of the original source code. Causes debugging information to be
227 -- written with respect to the generated code file that is written.
229 Display_Compilation_Progress : Boolean := False;
231 -- Set True (-d switch) to display information on progress while compiling
232 -- files. Internal switch to be used in conjunction with an IDE such as
235 type Distribution_Stub_Mode_Type is
238 -- Normal mode, no generation/compilation of distribution stubs
240 Generate_Receiver_Stub_Body,
241 -- The unit being compiled is the RCI body, and the compiler will
242 -- generate the body for the receiver stubs and compile it.
244 Generate_Caller_Stub_Body);
245 -- The unit being compiled is the RCI spec, and the compiler will
246 -- generate the body for the caller stubs and compile it.
248 Distribution_Stub_Mode : Distribution_Stub_Mode_Type := No_Stubs;
250 -- This enumeration variable indicates the five states of distribution
251 -- annex stub generation/compilation.
253 Do_Not_Execute : Boolean := False;
255 -- Set to True if no actual compilations should be undertaken.
257 Dynamic_Elaboration_Checks : Boolean := False;
259 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
260 -- switch or by the use of pragma Elaboration_Checks (Dynamic).
262 Elab_Dependency_Output : Boolean := False;
264 -- Set to True to output complete list of elaboration constraints
266 Elab_Order_Output : Boolean := False;
268 -- Set to True to output chosen elaboration order
270 Elab_Warnings : Boolean := False;
272 -- Set to True to generate full elaboration warnings (-gnatwl)
274 type Exception_Mechanism_Type is (Setjmp_Longjmp, Front_End_ZCX, GCC_ZCX);
275 Exception_Mechanism : Exception_Mechanism_Type := Setjmp_Longjmp;
277 -- Set to the appropriate value depending on the default as given in
278 -- system.ads (ZCX_By_Default, GCC_ZCX_Support, Front_End_ZCX_Support)
279 -- and the use of -gnatL -gnatZ (and -gnatdX)
281 Exception_Tracebacks : Boolean := False;
283 -- Set to True to store tracebacks in exception occurrences (-E)
285 Extensions_Allowed : Boolean := False;
288 type External_Casing_Type is (
289 As_Is, -- External names cased as they appear in the Ada source
290 Uppercase, -- External names forced to all uppercase letters
291 Lowercase); -- External names forced to all lowercase letters
293 External_Name_Imp_Casing : External_Casing_Type := Lowercase;
294 -- The setting of this switch determines the casing of external names
295 -- when the name is implicitly derived from an entity name (i.e. either
296 -- no explicit External_Name or Link_Name argument is used, or, in the
297 -- case of extended DEC pragmas, the external name is given using an
298 -- identifier. The As_Is setting is not permitted here (since this would
299 -- create Ada source programs that were case sensitive).
301 External_Name_Exp_Casing : External_Casing_Type := As_Is;
302 -- The setting of this switch determines the casing of an external name
303 -- specified explicitly with a string literal. As_Is means the string
304 -- literal is used as given with no modification to the casing. If
305 -- Lowercase or Uppercase is set, then the string is forced to all
306 -- lowercase or all uppercase letters as appropriate. Note that this
307 -- setting has no effect if the external name is given using an identifier
308 -- in the case of extended DEC import/export pragmas (in this case the
309 -- casing is controlled by External_Name_Imp_Casing), and also has no
310 -- effect if an explicit Link_Name is supplied (a link name is always
311 -- used exactly as given).
313 Float_Format : Character := ' ';
315 -- A non-blank value indicates that a Float_Format pragma has been
316 -- processed, in which case this variable is set to 'I
' for IEEE or
317 -- to 'V
' for VAX. The setting of 'V
' is only possible on OpenVMS
320 Float_Format_Long : Character := ' ';
322 -- A non-blank value indicates that a Long_Float pragma has been
323 -- processed (this pragma is recognized only in OpenVMS versions
324 -- of GNAT), in which case this variable is set to D or G for
325 -- D_Float or G_Float.
327 Force_ALI_Tree_File : Boolean := False;
329 -- Force generation of ali file even if errors are encountered.
330 -- Also forces generation of tree file if -gnatt is also set.
332 Force_Compilations : Boolean := False;
334 -- Set to force recompilations even when the objects are up-to-date.
336 Force_RM_Elaboration_Order : Boolean := False;
338 -- True if binding with forced RM elaboration order (-f switch set)
339 -- Note: this is considered an obsolescent option, to be removed in
340 -- some future release. it is no longer documented. The proper way
341 -- to get this effect is to use -gnatE and suppress elab checks.
343 Full_List : Boolean := False;
345 -- Set True to generate full source listing with embedded errors
347 Global_Discard_Names : Boolean := False;
349 -- Set true if a pragma Discard_Names applies to the current unit
351 GNAT_Mode : Boolean := False;
353 -- True if compiling in GNAT system mode (-g switch set)
355 HLO_Active : Boolean := False;
357 -- True if High Level Optimizer is activated
359 Implementation_Unit_Warnings : Boolean := True;
361 -- Set True to active warnings for use of implementation internal units.
362 -- Can be controlled by use of -gnatwi/-gnatwI.
364 Identifier_Character_Set : Character;
366 -- This variable indicates the character set to be used for identifiers.
367 -- The possible settings are:
372 -- 'p
' PC (US, IBM page 437)
373 -- '8' PC (European, IBM page 850)
374 -- 'f
' Full upper set (all distinct)
375 -- 'n
' No upper characters (Ada/83 rules)
376 -- 'w
' Latin-1 plus wide characters allowed in identifiers
378 -- The setting affects the set of letters allowed in identifiers and the
379 -- upper/lower case equivalences. It does not affect the interpretation of
380 -- character and string literals, which are always stored using the actual
381 -- coding in the source program. This variable is initialized to the
382 -- default value appropriate to the system (in Osint.Initialize), and then
383 -- reset if a command line switch is used to change the setting.
385 Ineffective_Inline_Warnings : Boolean := False;
387 -- Set True to activate warnings if front-end inlining (-gnatN) is not
388 -- able to actually inline a particular call (or all calls). Can be
389 -- controlled by use of -gnatwp/-gnatwP.
391 Init_Or_Norm_Scalars : Boolean := False;
393 -- Set True if a pragma Initialize_Scalars applies to the current unit.
394 -- Also set True if a pragma Normalize_Scalars applies.
396 Initialize_Scalars : Boolean := False;
398 -- Set True if a pragma Initialize_Scalars applies to the current unit.
399 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
401 Initialize_Scalars_Mode : Character := 'I
';
403 -- Set to 'I
' for -Sin (default), 'L
' for -Slo, 'H
' for -Shi, 'X
' for -Sxx
405 Initialize_Scalars_Val : String (1 .. 2);
407 -- Valid only if Initialize_Scalars_Mode is set to 'X
' (-Shh). Contains
408 -- the two hex bytes from the -Shh switch.
410 Inline_Active : Boolean := False;
412 -- Set True to activate pragma Inline processing across modules. Default
413 -- for now is not to inline across module boundaries.
415 Front_End_Inlining : Boolean := False;
417 -- Set True to activate inlining by front-end expansion.
419 Inline_Processing_Required : Boolean := False;
421 -- Set True if inline processing is required. Inline processing is
422 -- required if an active Inline pragma is processed. The flag is set
423 -- for a pragma Inline or Inline_Always that is actually active.
425 In_Place_Mode : Boolean := False;
427 -- Set True to store ALI and object files in place ie in the object
428 -- directory if these files already exist or in the source directory
431 Keep_Going : Boolean := False;
433 -- When True signals gnatmake to ignore compilation errors and keep
434 -- processing sources until there is no more work.
436 Link_Only : Boolean := False;
438 -- Set to True to skip compile and bind steps
439 -- (except when Bind_Only is set to True).
441 List_Units : Boolean := False;
443 -- List units in the active library
445 List_Dependencies : Boolean := False;
447 -- When True gnatmake verifies that the objects are up to date and
448 -- outputs the list of object dependencies. This list can be used
449 -- directly in a Makefile.
451 List_Representation_Info : Int range 0 .. 3 := 0;
453 -- Set true by -gnatR switch to list representation information.
454 -- The settings are as follows:
456 -- 0 = no listing of representation information (default as above)
457 -- 1 = list rep info for user defined record and array types
458 -- 2 = list rep info for all user defined types and objects
459 -- 3 = like 2, but variable fields are decoded symbolically
461 Locking_Policy : Character := ' ';
463 -- Set to ' ' for the default case (no locking policy specified).
464 -- Reset to first character (uppercase) of locking policy name if a
465 -- valid pragma Locking_Policy is encountered.
467 Look_In_Primary_Dir : Boolean := True;
468 -- GNAT, GNATBIND, GNATMAKE
469 -- Set to False if a -I- was present on the command line.
470 -- When True we are allowed to look in the primary directory to locate
471 -- other source or library files.
473 Mapping_File_Name : String_Ptr := null;
475 -- File name of mapping between unit names, file names and path names.
476 -- (given by switch -gnatem)
478 Maximum_Errors : Int := 9999;
480 -- Maximum number of errors before compilation is terminated
482 Maximum_File_Name_Length : Int;
484 -- Maximum number of characters allowed in a file name, not counting the
485 -- extension, as set by the appropriate switch. If no switch is given,
486 -- then this value is initialized by Osint to the appropriate value.
488 Maximum_Processes : Positive := 1;
490 -- Maximum number of processes that should be spawned to carry out
493 Minimal_Recompilation : Boolean := False;
495 -- Set to True if minimal recompilation mode requested.
497 No_Stdlib : Boolean := False;
499 -- Set to True if no default library search dirs added to search list.
501 No_Stdinc : Boolean := False;
503 -- Set to True if no default source search dirs added to search list.
505 No_Main_Subprogram : Boolean := False;
506 -- GNATMAKE, GNATBIND
507 -- Set to True if compilation/binding of a program without main
508 -- subprogram requested.
510 Normalize_Scalars : Boolean := False;
512 -- Set True if a pragma Normalize_Scalars applies to the current unit.
513 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
515 No_Run_Time : Boolean := False;
517 -- Set True if a valid pragma No_Run_Time is processed or if the
518 -- flag Targparm.High_Integrity_Mode_On_Target is set True.
520 type Operating_Mode_Type is (Check_Syntax, Check_Semantics, Generate_Code);
521 Operating_Mode : Operating_Mode_Type := Generate_Code;
523 -- Indicates the operating mode of the compiler. The default is generate
524 -- code, which runs the parser, semantics and backend. Switches can be
525 -- used to set syntax checking only mode, or syntax and semantics checking
526 -- only mode. Operating_Mode can also be modified as a result of detecting
527 -- errors during the compilation process. In particular if any error is
528 -- detected then this flag is reset from Generate_Code to Check_Semantics
529 -- after generating an error message.
531 Output_File_Name_Present : Boolean := False;
533 -- Set to True when the output C file name is given with option -o
534 -- for GNATBIND or when the object file name is given with option
537 Output_Linker_Option_List : Boolean := False;
539 -- True if output of list of linker options is requested (-K switch set)
541 Output_Object_List : Boolean := False;
543 -- True if output of list of objects is requested (-O switch set)
545 Pessimistic_Elab_Order : Boolean := False;
547 -- True if pessimistic elaboration order is to be chosen (-p switch set)
549 Polling_Required : Boolean := False;
551 -- Set to True if polling for asynchronous abort is enabled by using
552 -- the -gnatP option for GNAT.
554 Print_Generated_Code : Boolean := False;
556 -- Set to True to enable output of generated code in source form. This
557 -- flag is set by the -gnatG switch.
559 Propagate_Exceptions : Boolean := False;
561 -- Indicates if subprogram descriptor exception tables should be
562 -- built for imported subprograms. Set True if a Propagate_Exceptions
563 -- pragma applies to the extended main unit.
565 Queuing_Policy : Character := ' ';
567 -- Set to ' ' for the default case (no queuing policy specified). Reset to
568 -- Reset to first character (uppercase) of locking policy name if a valid
569 -- Queuing_Policy pragma is encountered.
571 Quiet_Output : Boolean := False;
573 -- Set to True if the list of compilation commands should not be output.
575 Shared_Libgnat : Boolean;
577 -- Set to True if a shared libgnat is requested by using the -shared
578 -- option for GNATBIND and to False when using the -static option. The
579 -- value of this switch is set by Gnatbind.Scan_Bind_Arg.
581 Software_Overflow_Checking : Boolean;
583 -- Set to True by Osint.Initialize if the target requires the software
584 -- approach to integer arithmetic overflow checking (i.e. the use of
585 -- double length arithmetic followed by a range check). Set to False
586 -- if the target implements hardware overflow checking.
588 Stack_Checking_Enabled : Boolean;
590 -- Set to indicate if -fstack-check switch is set for the compilation.
591 -- True means that the switch is set, so that stack checking is enabled.
592 -- False means that the switch is not set (no stack checking). This
593 -- value is obtained from the external imported value flag_stack_check
594 -- in the gcc backend (see Frontend) and may be referenced throughout
595 -- the compilation phases.
597 Strict_Math : aliased Boolean := False;
599 -- This switch is set True if the current unit is to be compiled in
600 -- strict math mode. The effect is to cause certain library file name
601 -- substitutions to implement strict math semantics. See the routine
602 -- Adjust_File_Name_For_Configuration, and also the configuration
603 -- in the body of Opt.
605 -- Note: currently this switch is always False. Eventually it will be
606 -- settable by a switch and a configuration pragma.
608 Style_Check : Boolean := False;
610 -- Set True to perform style checks. Activates checks carried out
611 -- in package Style (see body of this package for details of checks)
612 -- This flag is set True by either the -gnatg or -gnaty switches.
614 System_Extend_Pragma_Arg : Node_Id := Empty;
616 -- Set non-empty if and only if a correct Extend_System pragma was present
617 -- in which case it points to the argument of the pragma, and the name can
618 -- be located as Chars (Expression (System_Extend_Pragma_Arg)).
620 Subunits_Missing : Boolean := False;
621 -- This flag is set true if missing subunits are detected with code
622 -- generation active. This causes code generation to be skipped.
624 Suppress_Options : Suppress_Record;
626 -- Flags set True to suppress corresponding check, i.e. add an implicit
627 -- pragma Suppress at the outer level of each unit compiled. Note that
628 -- these suppress actions can be overridden by the use of the Unsuppress
629 -- pragma. This variable is initialized by Osint.Initialize.
631 Table_Factor : Int := 1;
632 -- Factor by which all initial table sizes set in Alloc are multiplied.
633 -- Used in Table to calculate initial table sizes (the initial table
634 -- size is the value in Alloc, used as the Table_Initial parameter
635 -- value, multiplied by the factor given here. The default value is
636 -- used if no -gnatT switch appears.
638 Task_Dispatching_Policy : Character := ' ';
640 -- Set to ' ' for the default case (no task dispatching policy specified).
641 -- Reset to first character (uppercase) of task dispatching policy name
642 -- if a valid Task_Dispatching_Policy pragma is encountered.
644 Tasking_Used : Boolean := False;
645 -- Set True if any tasking construct is encountered. Used to activate the
646 -- output of the Q, L and T lines in ali files.
648 Time_Slice_Set : Boolean := False;
649 -- Set True if a pragma Time_Slice is processed in the main unit, or
650 -- if the T switch is present to set a time slice value.
652 Time_Slice_Value : Nat;
653 -- Time slice value. Valid only if Time_Slice_Set is True, i.e. if a
654 -- Time_Slice pragma has been processed. Set to the time slice value
655 -- in microseconds. Negative values are stored as zero, and the value
656 -- is not larger than 1_000_000_000 (1000 seconds). Values larger than
657 -- this are reset to this maximum.
659 Tolerate_Consistency_Errors : Boolean := False;
661 -- Tolerate time stamp and other consistency errors. If this switch is
662 -- set true, then inconsistencies result in warnings rather than errors.
664 Tree_Output : Boolean := False;
666 -- Set True to generate output tree file
668 Try_Semantics : Boolean := False;
670 -- Flag set to force attempt at semantic analysis, even if parser errors
671 -- occur. This will probably cause blowups at this stage in the game. On
672 -- the other hand, most such blowups will be caught cleanly and simply
673 -- say compilation abandoned.
675 Unique_Error_Tag : Boolean := Tag_Errors;
677 -- Indicates if error messages are to be prefixed by the string error:
678 -- Initialized from Tag_Errors, can be forced on with the -gnatU switch.
680 Unreserve_All_Interrupts : Boolean := False;
682 -- Normally set False, set True if a valid Unreserve_All_Interrupts
683 -- pragma appears anywhere in the main unit for GNAT, or if any ALI
684 -- file has the corresponding attribute set in GNATBIND.
686 Upper_Half_Encoding : Boolean := False;
688 -- Normally set False, indicating that upper half ASCII characters are
689 -- used in the normal way to represent themselves. If the wide character
690 -- encoding method uses the upper bit for this encoding, then this flag
691 -- is set True, and upper half characters in the source indicate the
692 -- start of a wide character sequence.
694 Usage_Requested : Boolean := False;
695 -- GNAT, GNATBIND, GNATMAKE
696 -- Set to True if h switch encountered requesting usage information
698 Use_VADS_Size : Boolean := False;
700 -- Set to True if a valid pragma Use_VADS_Size is processed
702 Validity_Checks_On : Boolean := True;
703 -- This flag determines if validity checking is on or off. The initial
704 -- state is on, and the required default validity checks are active. The
705 -- actual set of checks that is performed if Validity_Checks_On is set
706 -- is defined by the switches in package Sem_Val. The Validity_Checks_On
707 -- switch is controlled by pragma Validity_Checks (On | Off), and also
708 -- some generated compiler code (typically code that has to do with
709 -- validity check generation) is compiled with this switch set to False.
711 Verbose_Mode : Boolean := False;
713 -- Set to True to get verbose mode (full error message text and location
714 -- information sent to standard output, also header, copyright and summary)
716 Warn_On_Biased_Rounding : Boolean := False;
718 -- Set to True to generate warnings for static constants that are rounded
719 -- in a manner inconsistent with unbiased rounding (round to even). Can
720 -- be modified by use of -gnatwb/B.
722 Warn_On_Hiding : Boolean := False;
724 -- Set to True to generate warnings if a declared entity hides another
725 -- entity. The default is that this warning is suppressed.
727 Warn_On_Redundant_Constructs : Boolean := False;
729 -- Set to True to generate warnings for redundant constructs (e.g. useless
730 -- assignments/conversions). The default is that this warning is disabled.
732 type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
733 Warning_Mode : Warning_Mode_Type := Normal;
735 -- Controls treatment of warning messages. If set to Suppress, warning
736 -- messages are not generated at all. In Normal mode, they are generated
737 -- but do not count as errors. In Treat_As_Error mode, warning messages
738 -- are generated and are treated as errors.
740 Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets;
742 -- Method used for encoding wide characters in the source program. See
743 -- description of type in unit System.WCh_Con for a list of the methods
744 -- that are currently supported. Note that brackets notation is always
745 -- recognized in source programs regardless of the setting of this
746 -- variable. The default setting causes only the brackets notation
747 -- to be recognized. If this is the main unit, this setting also
748 -- controls the output of the W=? parameter in the ali file, which
749 -- is used to provide the default for Wide_Text_IO files.
751 Xref_Active : Boolean := True;
753 -- Set if cross-referencing is enabled (i.e. xref info in ali files)
755 Zero_Cost_Exceptions_Val : Boolean;
756 Zero_Cost_Exceptions_Set : Boolean := False;
758 -- These values are to record the setting of the zero cost exception
759 -- handling mode set by argument switches (-gnatZ/-gnatL). If the
760 -- value is set by one of these switches, then Zero_Cost_Exceptions_Set
761 -- is set to True, and Zero_Cost_Exceptions_Val indicates the setting.
762 -- This value is used to reset ZCX_By_Default_On_Target.
764 ----------------------------
765 -- Configuration Settings --
766 ----------------------------
768 -- These are settings that are used to establish the mode at the start
769 -- of each unit. The values defined below can be affected either by
770 -- command line switches, or by the use of appropriate configuration
771 -- pragmas in the gnat.adc file.
773 Ada_83_Config : Boolean;
775 -- This is the value of the configuration switch for Ada 83 mode, as set
776 -- by the command line switch -gnat83, and possibly modified by the use
777 -- of configuration pragmas Ada_95 and Ada_83 in the gnat.adc file. This
778 -- switch is used to set the initial value for Ada_83 mode at the start
779 -- of analysis of a unit. Note however, that the setting of this switch
780 -- is ignored for internal and predefined units (which are always compiled
783 Dynamic_Elaboration_Checks_Config : Boolean := False;
785 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
786 -- switch or by the use of pragma Elaboration_Checking (Dynamic).
788 Extensions_Allowed_Config : Boolean;
790 -- This is the switch that indicates whether extensions are allowed.
791 -- It can be set True either by use of the -gnatX switch, or by use
792 -- of the configuration pragma Extensions_Allowed (On). It is always
793 -- set to True for internal GNAT units, since extensions are always
794 -- permitted in such units.
796 External_Name_Exp_Casing_Config : External_Casing_Type;
798 -- This is the value of the configuration switch that controls casing
799 -- of external symbols for which an explicit external name is given. It
800 -- can be set to Uppercase by the command line switch -gnatF, and further
801 -- modified by the use of the configuration pragma External_Name_Casing
802 -- in the gnat.adc file. This switch is used to set the initial value
803 -- for External_Name_Exp_Casing at the start of analyzing each unit.
804 -- Note however that the setting of this switch is ignored for internal
805 -- and predefined units (which are always compiled with As_Is mode).
807 External_Name_Imp_Casing_Config : External_Casing_Type;
809 -- This is the value of the configuration switch that controls casing
810 -- of external symbols where the external name is implicitly given. It
811 -- can be set to Uppercase by the command line switch -gnatF, and further
812 -- modified by the use of the configuration pragma External_Name_Casing
813 -- in the gnat.adc file. This switch is used to set the initial value
814 -- for External_Name_Imp_Casing at the start of analyzing each unit.
815 -- Note however that the setting of this switch is ignored for internal
816 -- and predefined units (which are always compiled with Lowercase mode).
818 Polling_Required_Config : Boolean;
820 -- This is the value of the configuration switch that controls polling
821 -- mode. It can be set True by the command line switch -gnatP, and then
822 -- further modified by the use of pragma Polling in the gnat.adc file.
823 -- This switch is used to set the initial value for Polling_Required
824 -- at the start of analyzing each unit.
826 Use_VADS_Size_Config : Boolean;
828 -- This is the value of the configuration switch that controls the use
829 -- of VADS_Size instead of Size whereever the attribute Size is used.
830 -- It can be set True by the use of the pragma Use_VADS_Size in the
831 -- gnat.adc file. This switch is used to set the initial value for
832 -- Use_VADS_Size at the start of analyzing each unit. Note however that
833 -- the setting of this switch is ignored for internal and predefined
834 -- units (which are always compiled with the standard Size semantics).
836 type Config_Switches_Type is private;
837 -- Type used to save values of the switches set from Config values
839 procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type);
840 -- This procedure saves the current values of the switches which are
841 -- initialized from the above Config values, and then resets these
842 -- switches according to the Config value settings.
844 procedure Set_Opt_Config_Switches (Internal_Unit : Boolean);
845 -- This procedure sets the switches to the appropriate initial values.
846 -- The parameter Internal_Unit is True for an internal or predefined
847 -- unit, and affects the way the switches are set (see above).
849 procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
850 -- This procedure restores a set of switch values previously saved
851 -- by a call to Save_Opt_Switches.
853 procedure Register_Opt_Config_Switches;
854 -- This procedure is called after processing the gnat.adc file to record
855 -- the values of the Config switches, as possibly modified by the use
856 -- of command line switches and configuration pragmas.
858 ------------------------
859 -- Other Global Flags --
860 ------------------------
862 Expander_Active : Boolean := False;
863 -- A flag that indicates if expansion is active (True) or deactivated
864 -- (False). When expansion is deactivated all calls to expander routines
865 -- have no effect. Note that the initial setting of False is merely to
866 -- prevent saving of an undefined value for an initial call to the
867 -- Expander_Mode_Save_And_Set procedure. For more information on the
868 -- use of this flag, see package Expander. Indeed this flag might more
869 -- logically be in the spec of Expander, but it is referenced by Errout,
870 -- and it really seems wrong for Errout to depend on Expander.
872 -----------------------
873 -- Tree I/O Routines --
874 -----------------------
877 -- Reads switch settings from current tree file using Tree_Read
879 procedure Tree_Write;
880 -- Writes out switch settings to current tree file using Tree_Write
884 type Config_Switches_Type is record
886 Dynamic_Elaboration_Checks : Boolean;
887 Extensions_Allowed : Boolean;
888 External_Name_Exp_Casing : External_Casing_Type;
889 External_Name_Imp_Casing : External_Casing_Type;
890 Polling_Required : Boolean;
891 Use_VADS_Size : Boolean;