1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2002, 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 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
36 -- This package contains global flags set by the initialization
37 -- routine from the command line and referenced throughout the compiler,
38 -- the binder, gnatmake or other GNAT tools. The comments indicate which
39 -- options are used by which programs (GNAT, GNATBIND, GNATMAKE, etc).
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";
73 Ada_Final_Name : String_Ptr := new String'("ada" & Ada_Final_Suffix);
75 -- The name of the procedure that performs the finalization at the end of
76 -- execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
78 Ada_Init_Suffix : constant String := "init";
79 Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix);
81 -- The name of the procedure that performs initialization at the start
82 -- of execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
84 Ada_Main_Name_Suffix : constant String := "main";
86 -- The suffix for Ada_Main_Name. Defined as a constant here so that it
87 -- can be referenced in a uniform manner to create either the default
88 -- value of Ada_Main_Name (declared below), or the non-default name
89 -- set by Gnatbind.Scan_Bind_Arg.
91 Ada_Main_Name : String_Ptr := new String'("ada_" & Ada_Main_Name_Suffix);
93 -- The name of the Ada package generated by the binder (when in Ada mode).
94 -- This variable may be modified by Gnatbind.Scan_Bind_Arg.
96 Address_Clause_Overlay_Warnings : Boolean := True;
98 -- Set False to disable address clause warnings
100 All_Errors_Mode : Boolean := False;
102 -- Flag set to force display of multiple errors on a single line and
103 -- also repeated error messages for references to undefined identifiers
104 -- and certain other repeated error messages.
106 All_Sources : Boolean := False;
108 -- Set to True to require all source files to be present. This flag is
109 -- directly modified by gnatmake to affect the shared binder routines.
111 Alternate_Main_Name : String_Ptr := null;
113 -- Set to non null when Bind_Alternate_Main_Name is True. This value
114 -- is modified as needed by Gnatbind.Scan_Bind_Arg.
116 Assertions_Enabled : Boolean := False;
118 -- Enable assertions made using pragma Assert.
120 Back_Annotate_Rep_Info : Boolean := False;
122 -- If set True (by use of -gnatB), enables back annotation of
123 -- representation information by gigi, even in -gnatc mode.
125 Bind_Alternate_Main_Name : Boolean := False;
127 -- True if main should be called Alternate_Main_Name.all.
128 -- This variable may be set to True by Gnatbind.Scan_Bind_Arg.
130 Bind_Main_Program : Boolean := True;
132 -- Set to False if not binding main Ada program.
134 Bind_For_Library : Boolean := False;
136 -- Set to True if the binder needs to generate a file designed for
137 -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
139 Bind_Only : Boolean := False;
141 -- Set to True to skip compile and link steps
142 -- (except when Compile_Only and/or Link_Only are True).
144 Brief_Output : Boolean := False;
146 -- Force brief error messages to standard error, even if verbose mode is
147 -- set (so that main error messages go to standard output).
149 Check_Object_Consistency : Boolean := False;
150 -- GNATBIND, GNATMAKE
151 -- Set to True to check whether every object file is consistent with
152 -- its corresponding ada library information (ALI) file. An object
153 -- file is inconsistent with the corresponding ALI file if the object
154 -- file does not exist or if it has an older time stamp than the ALI file.
155 -- Default above is for GNATBIND. GNATMAKE overrides this default to
156 -- True (see Make.Initialize) since we normally do need to check source
157 -- consistencies in gnatmake.
159 Check_Only : Boolean := False;
161 -- Set to True to do checks only, no output of binder file.
163 Check_Readonly_Files : Boolean := False;
165 -- Set to True to check readonly files during the make process.
167 Check_Source_Files : Boolean := True;
168 -- GNATBIND, GNATMAKE
169 -- Set to True to enable consistency checking for any source files that
170 -- are present (i.e. date must match the date in the library info file).
171 -- Set to False for object file consistency check only. This flag is
172 -- directly modified by gnatmake, to affect the shared binder routines.
174 Check_Switches : Boolean := False;
176 -- Set to True to check compiler options during the make process.
178 Check_Unreferenced : Boolean := False;
180 -- Set to True to enable checking for unreferenced entities other
181 -- than formal parameters (for which see Check_Unreferenced_Formals)
183 Check_Unreferenced_Formals : Boolean := False;
185 -- Set True to check for unreferenced formals. This is turned
186 -- on by -gnatwa/wf/wu and turned off by -gnatwA/wF/wU.
188 Check_Withs : Boolean := False;
190 -- Set to True to enable checking for unused withs, and also the case
191 -- of withing a package and using none of the entities in the package.
193 Compile_Only : Boolean := False;
195 -- Set to True to skip bind and link steps (except when Bind_Only is True)
197 Compress_Debug_Names : Boolean := False;
199 -- Set to True if the option to compress debug information is set (-gnatC)
201 Config_File : Boolean := True;
203 -- Set to False to inhibit reading and processing of gnat.adc file
205 Config_File_Name : String_Ptr := null;
207 -- File name of configuration pragmas file (given by switch -gnatec)
209 Constant_Condition_Warnings : Boolean := False;
211 -- Set to True to activate warnings on constant conditions
213 Create_Mapping_File : Boolean := False;
215 -- Set to True (-C switch) to indicate that gnatmake
216 -- invokes the compiler with a mapping file (-gnatem compiler switch).
218 subtype Debug_Level_Value is Nat range 0 .. 3;
219 Debugger_Level : Debug_Level_Value := 0;
221 -- The value given to the -g parameter.
222 -- The default value for -g with no value is 2
223 -- This is usually ignored by GNATBIND, except in the VMS version
224 -- where it is passed as an argument to __gnat_initialize to trigger
225 -- the activation of the remote debugging interface (is this true???).
227 Debug_Generated_Code : Boolean := False;
229 -- Set True (-gnatD switch) to debug generated expanded code instead
230 -- of the original source code. Causes debugging information to be
231 -- written with respect to the generated code file that is written.
233 Display_Compilation_Progress : Boolean := False;
235 -- Set True (-d switch) to display information on progress while compiling
236 -- files. Internal flag to be used in conjunction with an IDE such as
239 type Distribution_Stub_Mode_Type is
242 -- Normal mode, no generation/compilation of distribution stubs
244 Generate_Receiver_Stub_Body,
245 -- The unit being compiled is the RCI body, and the compiler will
246 -- generate the body for the receiver stubs and compile it.
248 Generate_Caller_Stub_Body);
249 -- The unit being compiled is the RCI spec, and the compiler will
250 -- generate the body for the caller stubs and compile it.
252 Distribution_Stub_Mode : Distribution_Stub_Mode_Type := No_Stubs;
254 -- This enumeration variable indicates the five states of distribution
255 -- annex stub generation/compilation.
257 Do_Not_Execute : Boolean := False;
259 -- Set to True if no actual compilations should be undertaken.
261 Dynamic_Elaboration_Checks : Boolean := False;
263 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
264 -- switch or by the use of pragma Elaboration_Checks (Dynamic).
266 Elab_Dependency_Output : Boolean := False;
268 -- Set to True to output complete list of elaboration constraints
270 Elab_Order_Output : Boolean := False;
272 -- Set to True to output chosen elaboration order
274 Elab_Warnings : Boolean := False;
276 -- Set to True to generate full elaboration warnings (-gnatwl)
278 Enable_Overflow_Checks : Boolean := False;
280 -- Set to True if -gnato (enable overflow checks) switch is set,
283 type Exception_Mechanism_Type is (Setjmp_Longjmp, Front_End_ZCX, GCC_ZCX);
284 pragma Convention (C, Exception_Mechanism_Type);
286 Exception_Mechanism : Exception_Mechanism_Type := Setjmp_Longjmp;
288 -- Set to the appropriate value depending on the default as given in
289 -- system.ads (ZCX_By_Default, GCC_ZCX_Support, Front_End_ZCX_Support)
290 -- and the use of -gnatL -gnatZ (and -gnatdX). The C convention is
291 -- there to make this variable accessible to gigi.
293 Exception_Tracebacks : Boolean := False;
295 -- Set to True to store tracebacks in exception occurrences (-E)
297 Extensions_Allowed : Boolean := False;
299 -- Set to True by switch -gnatX if GNAT specific language extensions
300 -- are allowed. For example, "with type" is a GNAT extension.
302 type External_Casing_Type is (
303 As_Is, -- External names cased as they appear in the Ada source
304 Uppercase, -- External names forced to all uppercase letters
305 Lowercase); -- External names forced to all lowercase letters
307 External_Name_Imp_Casing : External_Casing_Type := Lowercase;
309 -- The setting of this flag determines the casing of external names
310 -- when the name is implicitly derived from an entity name (i.e. either
311 -- no explicit External_Name or Link_Name argument is used, or, in the
312 -- case of extended DEC pragmas, the external name is given using an
313 -- identifier. The As_Is setting is not permitted here (since this would
314 -- create Ada source programs that were case sensitive).
316 External_Name_Exp_Casing : External_Casing_Type := As_Is;
318 -- The setting of this flag determines the casing of an external name
319 -- specified explicitly with a string literal. As_Is means the string
320 -- literal is used as given with no modification to the casing. If
321 -- Lowercase or Uppercase is set, then the string is forced to all
322 -- lowercase or all uppercase letters as appropriate. Note that this
323 -- setting has no effect if the external name is given using an identifier
324 -- in the case of extended DEC import/export pragmas (in this case the
325 -- casing is controlled by External_Name_Imp_Casing), and also has no
326 -- effect if an explicit Link_Name is supplied (a link name is always
327 -- used exactly as given).
329 Float_Format : Character := ' ';
331 -- A non-blank value indicates that a Float_Format pragma has been
332 -- processed, in which case this variable is set to 'I' for IEEE or
333 -- to 'V' for VAX. The setting of 'V' is only possible on OpenVMS
336 Float_Format_Long : Character := ' ';
338 -- A non-blank value indicates that a Long_Float pragma has been
339 -- processed (this pragma is recognized only in OpenVMS versions
340 -- of GNAT), in which case this variable is set to D or G for
341 -- D_Float or G_Float.
343 Force_ALI_Tree_File : Boolean := False;
345 -- Force generation of ALI file even if errors are encountered.
346 -- Also forces generation of tree file if -gnatt is also set.
348 Force_Compilations : Boolean := False;
350 -- Set to force recompilations even when the objects are up-to-date.
352 Force_RM_Elaboration_Order : Boolean := False;
354 -- True if binding with forced RM elaboration order (-f switch set)
355 -- Note: this is considered an obsolescent option, to be removed in
356 -- some future release. It is no longer documented. The proper way
357 -- to get this effect is to use -gnatE and suppress elab checks.
359 Full_List : Boolean := False;
361 -- Set True to generate full source listing with embedded errors
363 Global_Discard_Names : Boolean := False;
365 -- Set true if a pragma Discard_Names applies to the current unit
367 GNAT_Mode : Boolean := False;
369 -- True if compiling in GNAT system mode (-gnatg switch)
371 HLO_Active : Boolean := False;
373 -- True if High Level Optimizer is activated (-gnatH switch)
375 Implementation_Unit_Warnings : Boolean := True;
377 -- Set True to active warnings for use of implementation internal units.
378 -- Can be controlled by use of -gnatwi/-gnatwI.
380 Identifier_Character_Set : Character;
382 -- This variable indicates the character set to be used for identifiers.
383 -- The possible settings are:
384 -- '1' Latin-5 (ISO-8859-1)
385 -- '2' Latin-5 (ISO-8859-2)
386 -- '3' Latin-5 (ISO-8859-3)
387 -- '4' Latin-5 (ISO-8859-4)
388 -- '5' Latin-5 (ISO-8859-5, Cyrillic)
389 -- '9' Latin-5 (ISO-8859-9)
390 -- 'p' PC (US, IBM page 437)
391 -- '8' PC (European, IBM page 850)
392 -- 'f' Full upper set (all distinct)
393 -- 'n' No upper characters (Ada/83 rules)
394 -- 'w' Latin-1 plus wide characters allowed in identifiers
396 -- The setting affects the set of letters allowed in identifiers and the
397 -- upper/lower case equivalences. It does not affect the interpretation of
398 -- character and string literals, which are always stored using the actual
399 -- coding in the source program. This variable is initialized to the
400 -- default value appropriate to the system (in Osint.Initialize), and then
401 -- reset if a command line switch is used to change the setting.
403 Ineffective_Inline_Warnings : Boolean := False;
405 -- Set True to activate warnings if front-end inlining (-gnatN) is not
406 -- able to actually inline a particular call (or all calls). Can be
407 -- controlled by use of -gnatwp/-gnatwP.
409 Init_Or_Norm_Scalars : Boolean := False;
411 -- Set True if a pragma Initialize_Scalars applies to the current unit.
412 -- Also set True if a pragma Normalize_Scalars applies.
414 Initialize_Scalars : Boolean := False;
416 -- Set True if a pragma Initialize_Scalars applies to the current unit.
417 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
419 Initialize_Scalars_Mode : Character := 'I';
421 -- Set to 'I' for -Sin (default), 'L' for -Slo, 'H' for -Shi, 'X' for -Sxx
423 Initialize_Scalars_Val : String (1 .. 2);
425 -- Valid only if Initialize_Scalars_Mode is set to 'X' (-Shh). Contains
426 -- the two hex bytes from the -Shh switch.
428 Inline_Active : Boolean := False;
430 -- Set True to activate pragma Inline processing across modules. Default
431 -- for now is not to inline across module boundaries.
433 Front_End_Inlining : Boolean := False;
435 -- Set True to activate inlining by front-end expansion.
437 Inline_Processing_Required : Boolean := False;
439 -- Set True if inline processing is required. Inline processing is
440 -- required if an active Inline pragma is processed. The flag is set
441 -- for a pragma Inline or Inline_Always that is actually active.
443 In_Place_Mode : Boolean := False;
445 -- Set True to store ALI and object files in place ie in the object
446 -- directory if these files already exist or in the source directory
449 Keep_Going : Boolean := False;
451 -- When True signals gnatmake to ignore compilation errors and keep
452 -- processing sources until there is no more work.
454 Link_Only : Boolean := False;
456 -- Set to True to skip compile and bind steps
457 -- (except when Bind_Only is set to True).
459 List_Restrictions : Boolean := False;
461 -- Set to True to list restrictions pragmas that could apply to partition
463 List_Units : Boolean := False;
465 -- List units in the active library for a compilation (-gnatu switch)
467 List_Dependencies : Boolean := False;
469 -- When True gnatmake verifies that the objects are up to date and
470 -- outputs the list of object dependencies (-M switch).
471 -- Output depends if -a switch is used or not.
472 -- This list can be used directly in a Makefile.
474 List_Representation_Info : Int range 0 .. 3 := 0;
476 -- Set non-zero by -gnatR switch to list representation information.
477 -- The settings are as follows:
479 -- 0 = no listing of representation information (default as above)
480 -- 1 = list rep info for user defined record and array types
481 -- 2 = list rep info for all user defined types and objects
482 -- 3 = like 2, but variable fields are decoded symbolically
484 List_Representation_Info_To_File : Boolean := False;
486 -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3
487 -- to be written to file.rep (where file is the name of the source
488 -- file) instead of stdout. For example, if file x.adb is compiled
489 -- using -gnatR2s then representation info is written to x.adb.ref.
491 type Creat_Repinfo_File_Proc is access procedure (Src : File_Name_Type);
492 type Write_Repinfo_Line_Proc is access procedure (Info : String);
493 type Close_Repinfo_File_Proc is access procedure;
494 -- Types used for procedure addresses below
496 Creat_Repinfo_File_Access : Creat_Repinfo_File_Proc := null;
497 Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null;
498 Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null;
500 -- These three locations are left null when operating in non-compiler
501 -- (e.g. ASIS mode), but when operating in compiler mode, they are
502 -- set to point to the three corresponding procedures in Osint. The
503 -- reason for this slightly strange interface is to prevent Repinfo
504 -- from dragging in Osint in ASIS mode, which would include a lot of
505 -- unwanted units in the ASIS build.
507 Locking_Policy : Character := ' ';
509 -- Set to ' ' for the default case (no locking policy specified).
510 -- Reset to first character (uppercase) of locking policy name if a
511 -- valid pragma Locking_Policy is encountered.
513 Look_In_Primary_Dir : Boolean := True;
514 -- GNAT, GNATBIND, GNATMAKE
515 -- Set to False if a -I- was present on the command line.
516 -- When True we are allowed to look in the primary directory to locate
517 -- other source or library files.
519 Mapping_File_Name : String_Ptr := null;
521 -- File name of mapping between unit names, file names and path names.
522 -- (given by switch -gnatem)
524 Maximum_Errors : Int := 9999;
526 -- Maximum number of errors before compilation is terminated
528 Maximum_File_Name_Length : Int;
530 -- Maximum number of characters allowed in a file name, not counting the
531 -- extension, as set by the appropriate switch. If no switch is given,
532 -- then this value is initialized by Osint to the appropriate value.
534 Maximum_Processes : Positive := 1;
536 -- Maximum number of processes that should be spawned to carry out
539 Minimal_Recompilation : Boolean := False;
541 -- Set to True if minimal recompilation mode requested.
543 No_Stdlib : Boolean := False;
544 -- GNATMAKE, GNATBIND, GNATFIND, GNATXREF
545 -- Set to True if no default library search dirs added to search list.
547 No_Stdinc : Boolean := False;
548 -- GNAT, GNATBIND, GNATMAKE, GNATFIND, GNATXREF
549 -- Set to True if no default source search dirs added to search list.
551 No_Main_Subprogram : Boolean := False;
552 -- GNATMAKE, GNATBIND
553 -- Set to True if compilation/binding of a program without main
554 -- subprogram requested.
556 Normalize_Scalars : Boolean := False;
558 -- Set True if a pragma Normalize_Scalars applies to the current unit.
559 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
561 No_Run_Time : Boolean := False;
563 -- Set True if a valid pragma No_Run_Time is processed or if the
564 -- flag Targparm.High_Integrity_Mode_On_Target is set True.
566 type Operating_Mode_Type is (Check_Syntax, Check_Semantics, Generate_Code);
567 Operating_Mode : Operating_Mode_Type := Generate_Code;
569 -- Indicates the operating mode of the compiler. The default is generate
570 -- code, which runs the parser, semantics and backend. Switches can be
571 -- used to set syntax checking only mode, or syntax and semantics checking
572 -- only mode. Operating_Mode can also be modified as a result of detecting
573 -- errors during the compilation process. In particular if any error is
574 -- detected then this flag is reset from Generate_Code to Check_Semantics
575 -- after generating an error message.
577 Output_File_Name_Present : Boolean := False;
578 -- GNATBIND, GNAT, GNATMAKE
579 -- Set to True when the output C file name is given with option -o
580 -- for GNATBIND, when the object file name is given with option
581 -- -gnatO for GNAT or when the executable is given with option -o
584 Output_Linker_Option_List : Boolean := False;
586 -- True if output of list of linker options is requested (-K switch set)
588 Output_Object_List : Boolean := False;
590 -- True if output of list of objects is requested (-O switch set)
592 Pessimistic_Elab_Order : Boolean := False;
594 -- True if pessimistic elaboration order is to be chosen (-p switch set)
596 Polling_Required : Boolean := False;
598 -- Set to True if polling for asynchronous abort is enabled by using
599 -- the -gnatP option for GNAT.
601 Print_Generated_Code : Boolean := False;
603 -- Set to True to enable output of generated code in source form. This
604 -- flag is set by the -gnatG switch.
606 Propagate_Exceptions : Boolean := False;
608 -- Indicates if subprogram descriptor exception tables should be
609 -- built for imported subprograms. Set True if a Propagate_Exceptions
610 -- pragma applies to the extended main unit.
612 Queuing_Policy : Character := ' ';
614 -- Set to ' ' for the default case (no queuing policy specified).
615 -- Reset to first character (uppercase) of locking policy name if a valid
616 -- Queuing_Policy pragma is encountered.
618 Quiet_Output : Boolean := False;
620 -- Set to True if the list of compilation commands should not be output.
622 RTS_Switch : Boolean := False;
623 -- GNAT, GNATMAKE, GNATBIND, GNATLS, GNATFIND, GNATXREF
624 -- Set to True when the --RTS switch is set
626 Shared_Libgnat : Boolean;
628 -- Set to True if a shared libgnat is requested by using the -shared
629 -- option for GNATBIND and to False when using the -static option. The
630 -- value of this flag is set by Gnatbind.Scan_Bind_Arg.
632 Stack_Checking_Enabled : Boolean;
634 -- Set to indicate if -fstack-check switch is set for the compilation.
635 -- True means that the switch is set, so that stack checking is enabled.
636 -- False means that the switch is not set (no stack checking). This
637 -- value is obtained from the external imported value flag_stack_check
638 -- in the gcc backend (see Frontend) and may be referenced throughout
639 -- the compilation phases.
641 Style_Check : Boolean := False;
643 -- Set True to perform style checks. Activates checks carried out
644 -- in package Style (see body of this package for details of checks)
645 -- This flag is set True by either the -gnatg or -gnaty switches.
647 System_Extend_Pragma_Arg : Node_Id := Empty;
649 -- Set non-empty if and only if a correct Extend_System pragma was present
650 -- in which case it points to the argument of the pragma, and the name can
651 -- be located as Chars (Expression (System_Extend_Pragma_Arg)).
653 Subunits_Missing : Boolean := False;
655 -- This flag is set true if missing subunits are detected with code
656 -- generation active. This causes code generation to be skipped.
658 Suppress_Checks : Boolean := False;
660 -- Set to True if -gnatp (suppress all checks) switch present.
662 Suppress_Options : Suppress_Record;
664 -- Flags set True to suppress corresponding check, i.e. add an implicit
665 -- pragma Suppress at the outer level of each unit compiled. Note that
666 -- these suppress actions can be overridden by the use of the Unsuppress
667 -- pragma. This variable is initialized by Osint.Initialize.
669 Table_Factor : Int := 1;
671 -- Factor by which all initial table sizes set in Alloc are multiplied.
672 -- Used in Table to calculate initial table sizes (the initial table
673 -- size is the value in Alloc, used as the Table_Initial parameter
674 -- value, multiplied by the factor given here. The default value is
675 -- used if no -gnatT switch appears.
677 Task_Dispatching_Policy : Character := ' ';
679 -- Set to ' ' for the default case (no task dispatching policy specified).
680 -- Reset to first character (uppercase) of task dispatching policy name
681 -- if a valid Task_Dispatching_Policy pragma is encountered.
683 Tasking_Used : Boolean := False;
684 -- Set True if any tasking construct is encountered. Used to activate the
685 -- output of the Q, L and T lines in ALI files.
687 Time_Slice_Set : Boolean := False;
689 -- Set True if a pragma Time_Slice is processed in the main unit, or
690 -- if the -gnatTnn switch is present to set a time slice value.
692 Time_Slice_Value : Nat;
694 -- Time slice value. Valid only if Time_Slice_Set is True, i.e. if a
695 -- Time_Slice pragma has been processed. Set to the time slice value
696 -- in microseconds. Negative values are stored as zero, and the value
697 -- is not larger than 1_000_000_000 (1000 seconds). Values larger than
698 -- this are reset to this maximum. This can also be set with the -gnatTnn
701 Tolerate_Consistency_Errors : Boolean := False;
703 -- Tolerate time stamp and other consistency errors. If this flag is
704 -- set to True (-t), then inconsistencies result in warnings rather than
707 Tree_Output : Boolean := False;
709 -- Set to True (-gnatt) to generate output tree file
711 Try_Semantics : Boolean := False;
713 -- Flag set to force attempt at semantic analysis, even if parser errors
714 -- occur. This will probably cause blowups at this stage in the game. On
715 -- the other hand, most such blowups will be caught cleanly and simply
716 -- say compilation abandoned. This flag is set to True by -gnatq or -gnatQ.
718 Unique_Error_Tag : Boolean := Tag_Errors;
720 -- Indicates if error messages are to be prefixed by the string error:
721 -- Initialized from Tag_Errors, can be forced on with the -gnatU switch.
723 Unreserve_All_Interrupts : Boolean := False;
725 -- Normally set False, set True if a valid Unreserve_All_Interrupts
726 -- pragma appears anywhere in the main unit for GNAT, or if any ALI
727 -- file has the corresponding attribute set in GNATBIND.
729 Upper_Half_Encoding : Boolean := False;
731 -- Normally set False, indicating that upper half ASCII characters are
732 -- used in the normal way to represent themselves. If the wide character
733 -- encoding method uses the upper bit for this encoding, then this flag
734 -- is set True, and upper half characters in the source indicate the
735 -- start of a wide character sequence.
737 Usage_Requested : Boolean := False;
738 -- GNAT, GNATBIND, GNATMAKE
739 -- Set to True if -h (-gnath for the compiler) switch encountered
740 -- requesting usage information
742 Use_VADS_Size : Boolean := False;
744 -- Set to True if a valid pragma Use_VADS_Size is processed
746 Validity_Checks_On : Boolean := True;
748 -- This flag determines if validity checking is on or off. The initial
749 -- state is on, and the required default validity checks are active. The
750 -- actual set of checks that is performed if Validity_Checks_On is set
751 -- is defined by the switches in package Sem_Val. The Validity_Checks_On
752 -- flag is controlled by pragma Validity_Checks (On | Off), and also
753 -- some generated compiler code (typically code that has to do with
754 -- validity check generation) is compiled with this flag set to False.
755 -- This flag is set to False by the -gnatp switch.
757 Verbose_Mode : Boolean := False;
758 -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATCHOP, GNATNAME
759 -- Set to True to get verbose mode (full error message text and location
760 -- information sent to standard output, also header, copyright and summary)
762 Warn_On_Biased_Rounding : Boolean := False;
764 -- Set to True to generate warnings for static constants that are rounded
765 -- in a manner inconsistent with unbiased rounding (round to even). Can
766 -- be modified by use of -gnatwb/B.
768 Warn_On_Dereference : Boolean := False;
770 -- Set to True to generate warnings for implicit dereferences for array
771 -- indexing and record component access. Modified by use of -gnatwd/D.
773 Warn_On_Hiding : Boolean := False;
775 -- Set to True to generate warnings if a declared entity hides another
776 -- entity. The default is that this warning is suppressed.
778 Warn_On_Redundant_Constructs : Boolean := False;
780 -- Set to True to generate warnings for redundant constructs (e.g. useless
781 -- assignments/conversions). The default is that this warning is disabled.
783 type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
784 Warning_Mode : Warning_Mode_Type := Normal;
786 -- Controls treatment of warning messages. If set to Suppress, warning
787 -- messages are not generated at all. In Normal mode, they are generated
788 -- but do not count as errors. In Treat_As_Error mode, warning messages
789 -- are generated and are treated as errors.
791 Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets;
793 -- Method used for encoding wide characters in the source program. See
794 -- description of type in unit System.WCh_Con for a list of the methods
795 -- that are currently supported. Note that brackets notation is always
796 -- recognized in source programs regardless of the setting of this
797 -- variable. The default setting causes only the brackets notation
798 -- to be recognized. If this is the main unit, this setting also
799 -- controls the output of the W=? parameter in the ALI file, which
800 -- is used to provide the default for Wide_Text_IO files.
802 Xref_Active : Boolean := True;
804 -- Set if cross-referencing is enabled (i.e. xref info in ALI files)
806 Zero_Cost_Exceptions_Val : Boolean;
807 Zero_Cost_Exceptions_Set : Boolean := False;
809 -- These values are to record the setting of the zero cost exception
810 -- handling mode set by argument switches (-gnatZ/-gnatL). If the
811 -- value is set by one of these switches, then Zero_Cost_Exceptions_Set
812 -- is set to True, and Zero_Cost_Exceptions_Val indicates the setting.
814 ----------------------------
815 -- Configuration Settings --
816 ----------------------------
818 -- These are settings that are used to establish the mode at the start
819 -- of each unit. The values defined below can be affected either by
820 -- command line switches, or by the use of appropriate configuration
821 -- pragmas in the gnat.adc file.
823 Ada_83_Config : Boolean;
825 -- This is the value of the configuration switch for Ada 83 mode, as set
826 -- by the command line switch -gnat83, and possibly modified by the use
827 -- of configuration pragmas Ada_95 and Ada_83 in the gnat.adc file. This
828 -- switch is used to set the initial value for Ada_83 mode at the start
829 -- of analysis of a unit. Note however, that the setting of this flag
830 -- is ignored for internal and predefined units (which are always compiled
833 Dynamic_Elaboration_Checks_Config : Boolean := False;
835 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
836 -- switch or by the use of pragma Elaboration_Checking (Dynamic).
838 Extensions_Allowed_Config : Boolean;
840 -- This is the flag that indicates whether extensions are allowed.
841 -- It can be set True either by use of the -gnatX switch, or by use
842 -- of the configuration pragma Extensions_Allowed (On). It is always
843 -- set to True for internal GNAT units, since extensions are always
844 -- permitted in such units.
846 External_Name_Exp_Casing_Config : External_Casing_Type;
848 -- This is the value of the configuration switch that controls casing
849 -- of external symbols for which an explicit external name is given. It
850 -- can be set to Uppercase by the command line switch -gnatF, and further
851 -- modified by the use of the configuration pragma External_Name_Casing
852 -- in the gnat.adc file. This flag is used to set the initial value
853 -- for External_Name_Exp_Casing at the start of analyzing each unit.
854 -- Note however that the setting of this flag is ignored for internal
855 -- and predefined units (which are always compiled with As_Is mode).
857 External_Name_Imp_Casing_Config : External_Casing_Type;
859 -- This is the value of the configuration switch that controls casing
860 -- of external symbols where the external name is implicitly given. It
861 -- can be set to Uppercase by the command line switch -gnatF, and further
862 -- modified by the use of the configuration pragma External_Name_Casing
863 -- in the gnat.adc file. This flag is used to set the initial value
864 -- for External_Name_Imp_Casing at the start of analyzing each unit.
865 -- Note however that the setting of this flag is ignored for internal
866 -- and predefined units (which are always compiled with Lowercase mode).
868 Polling_Required_Config : Boolean;
870 -- This is the value of the configuration switch that controls polling
871 -- mode. It can be set True by the command line switch -gnatP, and then
872 -- further modified by the use of pragma Polling in the gnat.adc file.
873 -- This flag is used to set the initial value for Polling_Required
874 -- at the start of analyzing each unit.
876 Use_VADS_Size_Config : Boolean;
878 -- This is the value of the configuration switch that controls the use
879 -- of VADS_Size instead of Size whereever the attribute Size is used.
880 -- It can be set True by the use of the pragma Use_VADS_Size in the
881 -- gnat.adc file. This flag is used to set the initial value for
882 -- Use_VADS_Size at the start of analyzing each unit. Note however that
883 -- the setting of this flag is ignored for internal and predefined
884 -- units (which are always compiled with the standard Size semantics).
886 type Config_Switches_Type is private;
887 -- Type used to save values of the switches set from Config values
889 procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type);
890 -- This procedure saves the current values of the switches which are
891 -- initialized from the above Config values, and then resets these
892 -- switches according to the Config value settings.
894 procedure Set_Opt_Config_Switches (Internal_Unit : Boolean);
895 -- This procedure sets the switches to the appropriate initial values.
896 -- The parameter Internal_Unit is True for an internal or predefined
897 -- unit, and affects the way the switches are set (see above).
899 procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
900 -- This procedure restores a set of switch values previously saved
901 -- by a call to Save_Opt_Switches.
903 procedure Register_Opt_Config_Switches;
904 -- This procedure is called after processing the gnat.adc file to record
905 -- the values of the Config switches, as possibly modified by the use
906 -- of command line switches and configuration pragmas.
908 ------------------------
909 -- Other Global Flags --
910 ------------------------
912 Expander_Active : Boolean := False;
913 -- A flag that indicates if expansion is active (True) or deactivated
914 -- (False). When expansion is deactivated all calls to expander routines
915 -- have no effect. Note that the initial setting of False is merely to
916 -- prevent saving of an undefined value for an initial call to the
917 -- Expander_Mode_Save_And_Set procedure. For more information on the
918 -- use of this flag, see package Expander. Indeed this flag might more
919 -- logically be in the spec of Expander, but it is referenced by Errout,
920 -- and it really seems wrong for Errout to depend on Expander.
922 -----------------------
923 -- Tree I/O Routines --
924 -----------------------
927 -- Reads switch settings from current tree file using Tree_Read
929 procedure Tree_Write;
930 -- Writes out switch settings to current tree file using Tree_Write
934 type Config_Switches_Type is record
936 Dynamic_Elaboration_Checks : Boolean;
937 Extensions_Allowed : Boolean;
938 External_Name_Exp_Casing : External_Casing_Type;
939 External_Name_Imp_Casing : External_Casing_Type;
940 Polling_Required : Boolean;
941 Use_VADS_Size : Boolean;