objc/
[official-gcc.git] / gcc / ada / opt.ads
blob64a86d22ce74ab420085777ff84fa4da938fd778
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- O P T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package contains global flags set by the initialization routine from
35 -- the command line and referenced throughout the compiler, the binder, or
36 -- other GNAT tools. The comments indicate which options are used by which
37 -- programs (GNAT, GNATBIND, GNATMAKE, etc).
39 with Gnatvsn; use Gnatvsn;
40 with Hostparm; use Hostparm;
41 with Types; use Types;
43 with System.WCh_Con; use System.WCh_Con;
44 with GNAT.Strings; use GNAT.Strings;
46 package Opt is
48 ----------------------------------------------
49 -- Settings of Modes for Current Processing --
50 ----------------------------------------------
52 -- The following mode values represent the current state of processing.
53 -- The values set here are the default values. Unless otherwise noted,
54 -- the value may be reset in Switch with an appropropiate switch. In
55 -- some cases, the values can also be modified by pragmas, and in the
56 -- case of some binder variables, Gnatbind.Scan_Bind_Arg may modify
57 -- the default values.
59 Ada_Bind_File : Boolean := True;
60 -- GNATBIND, GNATLINK
61 -- Set True if binder file to be generated in Ada rather than C
63 type Ada_Version_Type is (Ada_83, Ada_95, Ada_05);
64 -- Versions of Ada for Ada_Version below. Note that these are ordered,
65 -- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
67 Ada_Version_Default : Ada_Version_Type := Ada_95;
68 -- GNAT
69 -- Default Ada version if no switch given
71 Ada_Version : Ada_Version_Type := Ada_Version_Default;
72 -- GNAT
73 -- Current Ada version for compiler, as set by configuration pragmas,
74 -- compiler switches, or implicitly (to Ada_Version_Runtime) when a
75 -- predefined or internal file is compiled.
77 Ada_Version_Explicit : Ada_Version_Type := Ada_Version_Default;
78 -- GNAT
79 -- Like Ada_Version, but does not get set implicitly for predefined
80 -- or internal units, so it reflects the Ada version explicitly set
81 -- using configuration pragmas or compiler switches (or if neither
82 -- appears, it remains set to Ada_Version_Default). This is used in
83 -- the rare cases (notably for pragmas Preelaborate_05 and Pure_05)
84 -- where in the run-time we want the explicit version set.
86 Ada_Version_Runtime : Ada_Version_Type := Ada_05;
87 -- GNAT
88 -- Ada version used to compile the runtime. Used to set Ada_Version (but
89 -- not Ada_Version_Explicit) when compiling predefined or internal units.
91 Ada_Final_Suffix : constant String := "final";
92 Ada_Final_Name : String_Ptr := new String'("ada" & Ada_Final_Suffix);
93 -- GNATBIND
94 -- The name of the procedure that performs the finalization at the end of
95 -- execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
97 Ada_Init_Suffix : constant String := "init";
98 Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix);
99 -- GNATBIND
100 -- The name of the procedure that performs initialization at the start
101 -- of execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
103 Ada_Main_Name_Suffix : constant String := "main";
104 -- GNATBIND
105 -- The suffix for Ada_Main_Name. Defined as a constant here so that it
106 -- can be referenced in a uniform manner to create either the default
107 -- value of Ada_Main_Name (declared below), or the non-default name
108 -- set by Gnatbind.Scan_Bind_Arg.
110 Ada_Main_Name : String_Ptr := new String'("ada_" & Ada_Main_Name_Suffix);
111 -- GNATBIND
112 -- The name of the Ada package generated by the binder (when in Ada mode).
113 -- This variable may be modified by Gnatbind.Scan_Bind_Arg.
115 Address_Clause_Overlay_Warnings : Boolean := True;
116 -- GNAT
117 -- Set False to disable address clause warnings
119 Address_Is_Private : Boolean := False;
120 -- GNAT, GNATBIND
121 -- Set True if package System has the line "type Address is private;"
123 All_Errors_Mode : Boolean := False;
124 -- GNAT
125 -- Flag set to force display of multiple errors on a single line and
126 -- also repeated error messages for references to undefined identifiers
127 -- and certain other repeated error messages.
129 All_Sources : Boolean := False;
130 -- GNATBIND
131 -- Set to True to require all source files to be present. This flag is
132 -- directly modified by gnatmake to affect the shared binder routines.
134 Alternate_Main_Name : String_Ptr := null;
135 -- GNATBIND
136 -- Set to non null when Bind_Alternate_Main_Name is True. This value
137 -- is modified as needed by Gnatbind.Scan_Bind_Arg.
139 Assertions_Enabled : Boolean := False;
140 -- GNAT
141 -- Enable assertions made using pragma Assert
143 ASIS_Mode : Boolean := False;
144 -- GNAT
145 -- Enable semantic checks and tree transformations that are important
146 -- for ASIS but that are usually skipped if Operating_Mode is set to
147 -- Check_Semantics. This flag does not have the corresponding option to set
148 -- it ON. It is set ON when Tree_Output is set ON, it can also be set ON
149 -- from the code of GNSA-based tool (a client may need to set ON the
150 -- Back_Annotate_Rep_Info flag in this case. At the moment this does not
151 -- make very much sense, because GNSA can not do back annotation).
153 Back_Annotate_Rep_Info : Boolean := False;
154 -- GNAT
155 -- If set True, enables back annotation of representation information
156 -- by gigi, even in -gnatc mode. This is set True by the use of -gnatR
157 -- (list representation information) or -gnatt (generate tree). It is
158 -- also set true if certain Unchecked_Conversion instantiations require
159 -- checking based on annotated values.
161 Bind_Alternate_Main_Name : Boolean := False;
162 -- GNATBIND
163 -- True if main should be called Alternate_Main_Name.all.
164 -- This variable may be set to True by Gnatbind.Scan_Bind_Arg.
166 Bind_Main_Program : Boolean := True;
167 -- GNATBIND
168 -- Set to False if not binding main Ada program
170 Bind_For_Library : Boolean := False;
171 -- GNATBIND
172 -- Set to True if the binder needs to generate a file designed for
173 -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
175 Bind_Only : Boolean := False;
176 -- GNATMAKE
177 -- Set to True to skip compile and link steps
178 -- (except when Compile_Only and/or Link_Only are True).
180 Blank_Deleted_Lines : Boolean := False;
181 -- GNAT, GNATPREP
182 -- Output empty lines for each line of preprocessed input that is deleted
183 -- in the output, including preprocessor lines starting with a '#'.
185 Brief_Output : Boolean := False;
186 -- GNAT, GNATBIND
187 -- Force brief error messages to standard error, even if verbose mode is
188 -- set (so that main error messages go to standard output).
190 Build_Bind_And_Link_Full_Project : Boolean := False;
191 -- GNATMAKE
192 -- Set to True to build, bind and link all the sources of a project file
193 -- (switch -B)
195 Check_Object_Consistency : Boolean := False;
196 -- GNATBIND, GNATMAKE
197 -- Set to True to check whether every object file is consistent with
198 -- its corresponding ada library information (ALI) file. An object
199 -- file is inconsistent with the corresponding ALI file if the object
200 -- file does not exist or if it has an older time stamp than the ALI file.
201 -- Default above is for GNATBIND. GNATMAKE overrides this default to
202 -- True (see Make.Initialize) since we normally do need to check source
203 -- consistencies in gnatmake.
205 Check_Only : Boolean := False;
206 -- GNATBIND
207 -- Set to True to do checks only, no output of binder file
209 Check_Readonly_Files : Boolean := False;
210 -- GNATMAKE
211 -- Set to True to check readonly files during the make process
213 Check_Source_Files : Boolean := True;
214 -- GNATBIND, GNATMAKE
215 -- Set to True to enable consistency checking for any source files that
216 -- are present (i.e. date must match the date in the library info file).
217 -- Set to False for object file consistency check only. This flag is
218 -- directly modified by gnatmake, to affect the shared binder routines.
220 Check_Switches : Boolean := False;
221 -- GNATMAKE
222 -- Set to True to check compiler options during the make process
224 Check_Unreferenced : Boolean := False;
225 -- GNAT
226 -- Set to True to enable checking for unreferenced entities other
227 -- than formal parameters (for which see Check_Unreferenced_Formals)
229 Check_Unreferenced_Formals : Boolean := False;
230 -- GNAT
231 -- Set True to check for unreferenced formals. This is turned on by
232 -- -gnatwa/wf/wu and turned off by -gnatwA/wF/wU.
234 Check_Withs : Boolean := False;
235 -- GNAT
236 -- Set to True to enable checking for unused withs, and also the case
237 -- of withing a package and using none of the entities in the package.
239 Comment_Deleted_Lines : Boolean := False;
240 -- GNATPREP
241 -- True if source lines removed by the preprocessor should be commented
242 -- in the output file.
244 Compile_Only : Boolean := False;
245 -- GNATMAKE, GNATCLEAN
246 -- GNATMAKE: set to True to skip bind and link steps (except when
247 -- Bind_Only is True).
248 -- GNATCLEAN: set to True to only the files produced by the compiler are to
249 -- be deleted, but not the library files or executable files.
251 Config_File : Boolean := True;
252 -- GNAT
253 -- Set to False to inhibit reading and processing of gnat.adc file
255 Config_File_Names : String_List_Access := null;
256 -- GNAT
257 -- Names of configuration pragmas files (given by switches -gnatec)
259 Configurable_Run_Time_Mode : Boolean := False;
260 -- GNAT, GNATBIND
261 -- Set True if the compiler is operating in configurable run-time mode.
262 -- This happens if the flag Targparm.Configurable_Run_TimeMode_On_Target
263 -- is set True, or if pragma No_Run_Time is used. See the spec of Rtsfind
264 -- for details on the handling of the latter pragma.
266 Constant_Condition_Warnings : Boolean := False;
267 -- GNAT
268 -- Set to True to activate warnings on constant conditions
270 Create_Mapping_File : Boolean := False;
271 -- GNATMAKE
272 -- Set to True (-C switch) to indicate that gnatmake will invoke
273 -- the compiler with a mapping file (-gnatem compiler switch).
275 subtype Debug_Level_Value is Nat range 0 .. 3;
276 Debugger_Level : Debug_Level_Value := 0;
277 -- GNATBIND
278 -- The value given to the -g parameter. The default value for -g with
279 -- no value is 2. This is usually ignored by GNATBIND, except in the
280 -- VMS version where it is passed as an argument to __gnat_initialize
281 -- to trigger the activation of the remote debugging interface.
282 -- Is this still true ???
284 Debug_Generated_Code : Boolean := False;
285 -- GNAT
286 -- Set True (-gnatD switch) to debug generated expanded code instead
287 -- of the original source code. Causes debugging information to be
288 -- written with respect to the generated code file that is written.
290 Default_Exit_Status : Int := 0;
291 -- GNATBIND
292 -- Set the default exit status value. Set by the -Xnnn switch for the
293 -- binder.
295 Default_Sec_Stack_Size : Int := -1;
296 -- GNATBIND
297 -- Set to default secondary stack size in units of kilobytes. Set by
298 -- the -Dnnn switch for the binder. A value of -1 indicates that no
299 -- default was set by the binder, and that the default should be the
300 -- initial value of System.Secondary_Stack.Default_Secondary_Stack_Size.
302 Detect_Blocking : Boolean := False;
303 -- GNAT
304 -- Set True to force the run time to raise Program_Error if calls to
305 -- potentially blocking operations are detected from protected actions.
307 Display_Compilation_Progress : Boolean := False;
308 -- GNATMAKE
309 -- Set True (-d switch) to display information on progress while compiling
310 -- files. Internal flag to be used in conjunction with an IDE (e.g GPS).
312 type Distribution_Stub_Mode_Type is
313 -- GNAT
314 (No_Stubs,
315 -- Normal mode, no generation/compilation of distribution stubs
317 Generate_Receiver_Stub_Body,
318 -- The unit being compiled is the RCI body, and the compiler will
319 -- generate the body for the receiver stubs and compile it.
321 Generate_Caller_Stub_Body);
322 -- The unit being compiled is the RCI spec, and the compiler will
323 -- generate the body for the caller stubs and compile it.
325 Distribution_Stub_Mode : Distribution_Stub_Mode_Type := No_Stubs;
326 -- GNAT
327 -- This enumeration variable indicates the five states of distribution
328 -- annex stub generation/compilation.
330 Do_Not_Execute : Boolean := False;
331 -- GNATMAKE
332 -- Set to True if no actual compilations should be undertaken.
334 Dynamic_Elaboration_Checks : Boolean := False;
335 -- GNAT
336 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
337 -- switch or by the use of pragma Elaboration_Checks (Dynamic).
339 Elab_Dependency_Output : Boolean := False;
340 -- GNATBIND
341 -- Set to True to output complete list of elaboration constraints
343 Elab_Order_Output : Boolean := False;
344 -- GNATBIND
345 -- Set to True to output chosen elaboration order
347 Elab_Warnings : Boolean := False;
348 -- GNAT
349 -- Set to True to generate full elaboration warnings (-gnatwl)
351 Enable_Overflow_Checks : Boolean := False;
352 -- GNAT
353 -- Set to True if -gnato (enable overflow checks) switch is set,
354 -- but not -gnatp.
356 Exception_Locations_Suppressed : Boolean := False;
357 -- GNAT
358 -- This flag is set True if a Suppress_Exception_Locations configuration
359 -- pragma is currently active.
361 type Exception_Mechanism_Type is
362 -- Determines the handling of exceptions. See Exp_Ch11 for details
364 (Front_End_Setjmp_Longjmp_Exceptions,
365 -- Exceptions use setjmp/longjmp generated explicitly by the
366 -- front end (this includes gigi or other equivalent parts of
367 -- the code generator). AT END handlers are converted into
368 -- exception handlers by the front end in this mode.
370 Front_End_ZCX_Exceptions,
371 -- Exceptions use the zero cost table mechanism with explicit
372 -- tables and exception regions generated by the front end.
373 -- AT END handlers are converted into exception handlers by
374 -- the front end in this mode.
376 Back_End_ZCX_Exceptions);
377 -- Exceptions are handled by the back end. The front end simply
378 -- generates the handlers as they appear in the source, and AT
379 -- END handlers are left untouched (they are not converted into
380 -- exception handlers when operating in this mode. Note that the
381 -- name includes ZCX, since the expectation is that the back end
382 -- mechanism will in fact be a ZCX approach, but nothing in the
383 -- compiler depends on this, so for example if GNAT is run with
384 -- a version of GCC configured for setjmp/longjmp exception handling,
385 -- then everything will work fine.
386 pragma Convention (C, Exception_Mechanism_Type);
388 Exception_Mechanism : Exception_Mechanism_Type :=
389 Front_End_Setjmp_Longjmp_Exceptions;
390 -- GNAT
391 -- Set to the appropriate value depending on the default as given in
392 -- system.ads (ZCX_By_Default, GCC_ZCX_Support, Front_End_ZCX_Support) and
393 -- the use of -gnatL -gnatZ (and -gnatdX). The C convention is there to
394 -- make this variable accessible to gigi.
396 Exception_Tracebacks : Boolean := False;
397 -- GNATBIND
398 -- Set to True to store tracebacks in exception occurrences (-E)
400 Extensions_Allowed : Boolean := False;
401 -- GNAT
402 -- Set to True by switch -gnatX if GNAT specific language extensions
403 -- are allowed. For example, "limited with" is a GNAT extension.
405 type External_Casing_Type is (
406 As_Is, -- External names cased as they appear in the Ada source
407 Uppercase, -- External names forced to all uppercase letters
408 Lowercase); -- External names forced to all lowercase letters
410 External_Name_Imp_Casing : External_Casing_Type := Lowercase;
411 -- GNAT
412 -- The setting of this flag determines the casing of external names
413 -- when the name is implicitly derived from an entity name (i.e. either
414 -- no explicit External_Name or Link_Name argument is used, or, in the
415 -- case of extended DEC pragmas, the external name is given using an
416 -- identifier. The As_Is setting is not permitted here (since this would
417 -- create Ada source programs that were case sensitive).
419 External_Name_Exp_Casing : External_Casing_Type := As_Is;
420 -- GNAT
421 -- The setting of this flag determines the casing of an external name
422 -- specified explicitly with a string literal. As_Is means the string
423 -- literal is used as given with no modification to the casing. If
424 -- Lowercase or Uppercase is set, then the string is forced to all
425 -- lowercase or all uppercase letters as appropriate. Note that this
426 -- setting has no effect if the external name is given using an identifier
427 -- in the case of extended DEC import/export pragmas (in this case the
428 -- casing is controlled by External_Name_Imp_Casing), and also has no
429 -- effect if an explicit Link_Name is supplied (a link name is always
430 -- used exactly as given).
432 External_Unit_Compilation_Allowed : Boolean := False;
433 -- GNATMAKE
434 -- When True (set by gnatmake switch -x), allow compilation of sources
435 -- that are not part of any project file.
437 Float_Format : Character := ' ';
438 -- GNAT
439 -- A non-blank value indicates that a Float_Format pragma has been
440 -- processed, in which case this variable is set to 'I' for IEEE or
441 -- to 'V' for VAX. The setting of 'V' is only possible on OpenVMS
442 -- versions of GNAT.
444 Float_Format_Long : Character := ' ';
445 -- GNAT
446 -- A non-blank value indicates that a Long_Float pragma has been
447 -- processed (this pragma is recognized only in OpenVMS versions
448 -- of GNAT), in which case this variable is set to D or G for
449 -- D_Float or G_Float.
451 Force_ALI_Tree_File : Boolean := False;
452 -- GNAT
453 -- Force generation of ALI file even if errors are encountered.
454 -- Also forces generation of tree file if -gnatt is also set.
456 Force_Checking_Of_Elaboration_Flags : Boolean := False;
457 -- GNATBIND
458 -- True if binding with forced checking of the elaboration flags
459 -- (-F switch set).
461 Force_Compilations : Boolean := False;
462 -- GNATMAKE
463 -- Set to force recompilations even when the objects are up-to-date.
465 Full_Path_Name_For_Brief_Errors : Boolean := False;
466 -- GNAT, GNATMAKE, GNATCLEAN
467 -- When True, in Brief_Output mode, each error message line
468 -- will start with the full path name of the source.
469 -- When False, only the file name without directory information
470 -- is used.
472 Full_List : Boolean := False;
473 -- GNAT
474 -- Set True to generate full source listing with embedded errors
476 function get_gcc_version return Int;
477 pragma Import (C, get_gcc_version, "get_gcc_version");
479 GCC_Version : constant Nat := get_gcc_version;
480 -- GNATMAKE
481 -- Indicates which version of gcc is in use (2 = 2.8.1, 3 = 3.x)
483 Global_Discard_Names : Boolean := False;
484 -- GNAT, GNATBIND
485 -- Set true if a pragma Discard_Names applies to the current unit
487 GNAT_Mode : Boolean := False;
488 -- GNAT
489 -- True if compiling in GNAT system mode (-gnatg switch)
491 HLO_Active : Boolean := False;
492 -- GNAT
493 -- True if High Level Optimizer is activated (-gnatH switch)
495 Implementation_Unit_Warnings : Boolean := True;
496 -- GNAT
497 -- Set True to active warnings for use of implementation internal units.
498 -- Can be controlled by use of -gnatwi/-gnatwI.
500 Identifier_Character_Set : Character;
501 -- GNAT
502 -- This variable indicates the character set to be used for identifiers.
503 -- The possible settings are:
504 -- '1' Latin-5 (ISO-8859-1)
505 -- '2' Latin-5 (ISO-8859-2)
506 -- '3' Latin-5 (ISO-8859-3)
507 -- '4' Latin-5 (ISO-8859-4)
508 -- '5' Latin-5 (ISO-8859-5, Cyrillic)
509 -- '9' Latin-5 (ISO-8859-9)
510 -- 'p' PC (US, IBM page 437)
511 -- '8' PC (European, IBM page 850)
512 -- 'f' Full upper set (all distinct)
513 -- 'n' No upper characters (Ada 83 rules)
514 -- 'w' Latin-1 plus wide characters allowed in identifiers
516 -- The setting affects the set of letters allowed in identifiers and the
517 -- upper/lower case equivalences. It does not affect the interpretation of
518 -- character and string literals, which are always stored using the actual
519 -- coding in the source program. This variable is initialized to the
520 -- default value appropriate to the system (in Osint.Initialize), and then
521 -- reset if a command line switch is used to change the setting.
523 Ineffective_Inline_Warnings : Boolean := False;
524 -- GNAT
525 -- Set True to activate warnings if front-end inlining (-gnatN) is not
526 -- able to actually inline a particular call (or all calls). Can be
527 -- controlled by use of -gnatwp/-gnatwP.
529 Init_Or_Norm_Scalars : Boolean := False;
530 -- GNAT, GANTBIND
531 -- Set True if a pragma Initialize_Scalars applies to the current unit.
532 -- Also set True if a pragma Normalize_Scalars applies.
534 Initialize_Scalars : Boolean := False;
535 -- GNAT
536 -- Set True if a pragma Initialize_Scalars applies to the current unit.
537 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
539 Initialize_Scalars_Mode1 : Character := 'I';
540 Initialize_Scalars_Mode2 : Character := 'N';
541 -- GNATBIND
542 -- Set to two characters from -S switch (IN/LO/HI/EV/xx). The default
543 -- is IN (invalid values), used if no -S switch is used.
545 Inline_Active : Boolean := False;
546 -- GNAT
547 -- Set True to activate pragma Inline processing across modules. Default
548 -- for now is not to inline across module boundaries.
550 Interface_Library_Unit : Boolean := False;
551 -- GNATBIND
552 -- Set to True to indicate that at least one ALI file is an interface ALI:
553 -- then elaboration flag checks are to be generated in the binder
554 -- generated file.
556 Follow_Links : Boolean := False;
557 -- GNATMAKE
558 -- Set to True (-eL) to process the project files in trusted mode
560 Front_End_Inlining : Boolean := False;
561 -- GNAT
562 -- Set True to activate inlining by front-end expansion
564 Inline_Processing_Required : Boolean := False;
565 -- GNAT
566 -- Set True if inline processing is required. Inline processing is
567 -- required if an active Inline pragma is processed. The flag is set
568 -- for a pragma Inline or Inline_Always that is actually active.
570 In_Place_Mode : Boolean := False;
571 -- GNATMAKE
572 -- Set True to store ALI and object files in place ie in the object
573 -- directory if these files already exist or in the source directory
574 -- if not.
576 Keep_Going : Boolean := False;
577 -- GNATMAKE
578 -- When True signals gnatmake to ignore compilation errors and keep
579 -- processing sources until there is no more work.
581 Keep_Temporary_Files : Boolean := False;
582 -- GNATCMD
583 -- When True the temporary files created by the GNAT driver are not
584 -- deleted. Set by switch -dn or qualifier /KEEP_TEMPORARY_FILES.
586 Link_Only : Boolean := False;
587 -- GNATMAKE
588 -- Set to True to skip compile and bind steps
589 -- (except when Bind_Only is set to True).
591 List_Restrictions : Boolean := False;
592 -- GNATBIND
593 -- Set to True to list restrictions pragmas that could apply to partition
595 List_Units : Boolean := False;
596 -- GNAT
597 -- List units in the active library for a compilation (-gnatu switch)
599 List_Dependencies : Boolean := False;
600 -- GNATMAKE
601 -- When True gnatmake verifies that the objects are up to date and
602 -- outputs the list of object dependencies (-M switch).
603 -- Output depends if -a switch is used or not.
604 -- This list can be used directly in a Makefile.
606 List_Representation_Info : Int range 0 .. 3 := 0;
607 -- GNAT
608 -- Set non-zero by -gnatR switch to list representation information.
609 -- The settings are as follows:
611 -- 0 = no listing of representation information (default as above)
612 -- 1 = list rep info for user defined record and array types
613 -- 2 = list rep info for all user defined types and objects
614 -- 3 = like 2, but variable fields are decoded symbolically
616 List_Representation_Info_To_File : Boolean := False;
617 -- GNAT
618 -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3
619 -- to be written to file.rep (where file is the name of the source
620 -- file) instead of stdout. For example, if file x.adb is compiled
621 -- using -gnatR2s then representation info is written to x.adb.ref.
623 List_Representation_Info_Mechanisms : Boolean := False;
624 -- GNAT
625 -- Set true by -gnatRm switch. Causes information on mechanisms to
626 -- be included in the representation output information.
628 List_Preprocessing_Symbols : Boolean := False;
629 -- GNAT, GNATPREP
630 -- Set to True if symbols for preprocessing a source are to be listed
631 -- before preprocessing occurs. Set to True by switch -s of gnatprep
632 -- or -s in preprocessing data file for the compiler.
634 type Creat_Repinfo_File_Proc is access procedure (Src : File_Name_Type);
635 type Write_Repinfo_Line_Proc is access procedure (Info : String);
636 type Close_Repinfo_File_Proc is access procedure;
637 -- Types used for procedure addresses below
639 Creat_Repinfo_File_Access : Creat_Repinfo_File_Proc := null;
640 Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null;
641 Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null;
642 -- GNAT
643 -- These three locations are left null when operating in non-compiler
644 -- (e.g. ASIS mode), but when operating in compiler mode, they are
645 -- set to point to the three corresponding procedures in Osint. The
646 -- reason for this slightly strange interface is to prevent Repinfo
647 -- from dragging in Osint in ASIS mode, which would include a lot of
648 -- unwanted units in the ASIS build.
650 Locking_Policy : Character := ' ';
651 -- GNAT, GNATBIND
652 -- Set to ' ' for the default case (no locking policy specified).
653 -- Reset to first character (uppercase) of locking policy name if a
654 -- valid pragma Locking_Policy is encountered.
656 Locking_Policy_Sloc : Source_Ptr := No_Location;
657 -- GNAT, GNATBIND
658 -- Remember location of previous Locking_Policy pragma. This is used
659 -- for inconsistency error messages. A value of System_Location is
660 -- used if the policy is set in package System.
662 Look_In_Primary_Dir : Boolean := True;
663 -- GNAT, GNATBIND, GNATMAKE, GNATCLEAN
664 -- Set to False if a -I- was present on the command line.
665 -- When True we are allowed to look in the primary directory to locate
666 -- other source or library files.
668 Make_Steps : Boolean := False;
669 -- GNATMAKE
670 -- Set to True when either Compile_Only, Bind_Only or Link_Only is
671 -- set to True.
673 Main_Index : Int := 0;
674 -- GNATMAKE
675 -- This is set to non-zero by gnatmake switch -eInnn to indicate that
676 -- the main program is the nnn unit in a multi-unit source file.
678 Mapping_File_Name : String_Ptr := null;
679 -- GNAT
680 -- File name of mapping between unit names, file names and path names.
681 -- (given by switch -gnatem)
683 Maximum_Errors : Int := 9999;
684 -- GNAT, GNATBIND
685 -- Maximum default number of errors before compilation is terminated.
686 -- Can be overridden using -gnatm (GNAT) or -m (GNATBIND) switch.
688 Maximum_File_Name_Length : Int;
689 -- GNAT, GNATBIND
690 -- Maximum number of characters allowed in a file name, not counting the
691 -- extension, as set by the appropriate switch. If no switch is given,
692 -- then this value is initialized by Osint to the appropriate value.
694 Max_Line_Length : Int := Hostparm.Max_Line_Length;
695 -- This is a copy of Max_Line_Length used by the scanner. It is usually
696 -- set to be a copy of Hostparm.Max_Line_Length, and is used to check
697 -- the maximum line length in the scanner when style checking is inactive.
698 -- The only time it is set to a different value is during the scanning of
699 -- configuration pragma files, where we want to turn off all checking and
700 -- in particular we want to allow long lines. So we reset this value to
701 -- Column_Number'Last during scanning of configuration pragma files.
703 Maximum_Processes : Positive := 1;
704 -- GNATMAKE
705 -- Maximum number of processes that should be spawned to carry out
706 -- compilations.
708 Minimal_Recompilation : Boolean := False;
709 -- GNATMAKE
710 -- Set to True if minimal recompilation mode requested
712 Multiple_Unit_Index : Int;
713 -- GNAT
714 -- This is set non-zero if the current unit is being compiled in multiple
715 -- unit per file mode, meaning that the current unit is selected from the
716 -- sequence of units in the current source file, using the value stored
717 -- in this variable (e.g. 2 = select second unit in file). A value of
718 -- zero indicates that we are in normal (one unit per file) mode.
720 No_Main_Subprogram : Boolean := False;
721 -- GNATMAKE, GNATBIND
722 -- Set to True if compilation/binding of a program without main
723 -- subprogram requested.
725 No_Run_Time_Mode : Boolean := False;
726 -- GNAT, GNATBIND
727 -- This flag is set True if a No_Run_Time pragma is encountered. See
728 -- spec of Rtsfind for a full description of handling of this pragma.
730 No_Stdinc : Boolean := False;
731 -- GNAT, GNATBIND, GNATMAKE, GNATFIND, GNATXREF
732 -- Set to True if no default source search dirs added to search list
734 No_Stdlib : Boolean := False;
735 -- GNATMAKE, GNATBIND, GNATFIND, GNATXREF
736 -- Set to True if no default library search dirs added to search list
738 No_Strict_Aliasing : Boolean := False;
739 -- GNAT
740 -- Set True if pragma No_Strict_Aliasing with no parameters encountered
742 Normalize_Scalars : Boolean := False;
743 -- GNAT, GNATBIND
744 -- Set True if a pragma Normalize_Scalars applies to the current unit.
745 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
747 Object_Directory_Present : Boolean := False;
748 -- GNATMAKE
749 -- Set to True when an object directory is specified with option -D
751 type Operating_Mode_Type is (Check_Syntax, Check_Semantics, Generate_Code);
752 Operating_Mode : Operating_Mode_Type := Generate_Code;
753 -- GNAT
754 -- Indicates the operating mode of the compiler. The default is generate
755 -- code, which runs the parser, semantics and backend. Switches can be
756 -- used to set syntax checking only mode, or syntax and semantics checking
757 -- only mode. Operating_Mode can also be modified as a result of detecting
758 -- errors during the compilation process. In particular if any serious
759 -- error is detected then this flag is reset from Generate_Code to
760 -- Check_Semantics after generating an error message.
762 Original_Operating_Mode : Operating_Mode_Type := Generate_Code;
763 -- GNAT
764 -- Indicates the original operating mode of the compiler as set by
765 -- compiler options. This is identical to Operating_Mode except that
766 -- this is not affected by errors.
768 Optimization_Level : Int;
769 pragma Import (C, Optimization_Level, "optimize");
770 -- This constant reflects the optimization level (0,1,2 for -O0,-O1,-O2)
772 Output_File_Name_Present : Boolean := False;
773 -- GNATBIND, GNAT, GNATMAKE
774 -- Set to True when the output C file name is given with option -o
775 -- for GNATBIND, when the object file name is given with option
776 -- -gnatO for GNAT or when the executable is given with option -o
777 -- for GNATMAKE.
779 Output_Linker_Option_List : Boolean := False;
780 -- GNATBIND
781 -- True if output of list of linker options is requested (-K switch set)
783 Output_Object_List : Boolean := False;
784 -- GNATBIND
785 -- True if output of list of objects is requested (-O switch set)
787 Persistent_BSS_Mode : Boolean := False;
788 -- GNAT
789 -- True if a Persistent_BSS configuration pragma is in effect, causing
790 -- potentially persistent data to be placed in the persistent_bss section.
792 Pessimistic_Elab_Order : Boolean := False;
793 -- GNATBIND
794 -- True if pessimistic elaboration order is to be chosen (-p switch set)
796 Polling_Required : Boolean := False;
797 -- GNAT
798 -- Set to True if polling for asynchronous abort is enabled by using
799 -- the -gnatP option for GNAT.
801 Preprocessing_Data_File : String_Ptr := null;
802 -- GNAT
803 -- Set by switch -gnatep=. The file name of the prepocessing data file.
805 Print_Generated_Code : Boolean := False;
806 -- GNAT
807 -- Set to True to enable output of generated code in source form. This
808 -- flag is set by the -gnatG switch.
810 Print_Standard : Boolean := False;
811 -- GNAT
812 -- Set to true to enable printing of package standard in source form.
813 -- This flag is set by the -gnatS switch
815 Propagate_Exceptions : Boolean := False;
816 -- GNAT
817 -- Indicates if subprogram descriptor exception tables should be
818 -- built for imported subprograms. Set True if a Propagate_Exceptions
819 -- pragma applies to the extended main unit.
821 type Usage is (Unknown, Not_In_Use, In_Use);
822 Project_File_In_Use : Usage := Unknown;
823 -- GNAT
824 -- Indicates if a project file is used or not.
825 -- Set to In_Use by the first SFNP pragma.
827 Queuing_Policy : Character := ' ';
828 -- GNAT, GNATBIND
829 -- Set to ' ' for the default case (no queuing policy specified).
830 -- Reset to first character (uppercase) of locking policy name if a valid
831 -- Queuing_Policy pragma is encountered.
833 Queuing_Policy_Sloc : Source_Ptr := No_Location;
834 -- GNAT, GNATBIND
835 -- Remember location of previous Queuing_Policy pragma. This is used
836 -- for inconsistency error messages. A value of System_Location is
837 -- used if the policy is set in package System.
839 Quiet_Output : Boolean := False;
840 -- GNATMAKE, GNATCLEAN, GPR2MAKE
841 -- Set to True if the tool should not have any output if there are no
842 -- errors or warnings.
844 RTS_Lib_Path_Name : String_Ptr := null;
845 RTS_Src_Path_Name : String_Ptr := null;
846 -- GNAT
847 -- Set to the "adalib" and "adainclude" directories of the run time
848 -- specified by --RTS=.
850 RTS_Switch : Boolean := False;
851 -- GNAT, GNATMAKE, GNATBIND, GNATLS, GNATFIND, GNATXREF
852 -- Set to True when the --RTS switch is set
854 Run_Path_Option : Boolean := True;
855 -- GNATMAKE, GNATLINK
856 -- Set to False when no run_path_option should be issued to the linker
858 Sec_Stack_Used : Boolean := False;
859 -- GNAT, GBATBIND
860 -- Set True if generated code uses the System.Secondary_Stack package.
861 -- For the binder, set if any unit uses the secondary stack package.
863 Setup_Projects : Boolean := False;
864 -- GNAT DRIVER
865 -- Set to True for GNAT SETUP: the Project Manager creates non existing
866 -- object, library and exec directories.
868 Shared_Libgnat : Boolean;
869 -- GNATBIND
870 -- Set to True if a shared libgnat is requested by using the -shared
871 -- option for GNATBIND and to False when using the -static option. The
872 -- value of this flag is set by Gnatbind.Scan_Bind_Arg.
874 Stack_Checking_Enabled : Boolean;
875 -- GNAT
876 -- Set to indicate if -fstack-check switch is set for the compilation. True
877 -- means that the switch is set, so that stack checking is enabled. False
878 -- means that the switch is not set (no stack checking). This value is
879 -- obtained from the external imported value flag_stack_check in the gcc
880 -- backend (see Frontend) and may be referenced throughout the compilation
881 -- phases.
883 Style_Check : Boolean := False;
884 -- GNAT
885 -- Set True to perform style checks. Activates checks carried out
886 -- in package Style (see body of this package for details of checks)
887 -- This flag is set True by either the -gnatg or -gnaty switches.
889 System_Extend_Pragma_Arg : Node_Id := Empty;
890 -- GNAT
891 -- Set non-empty if and only if a correct Extend_System pragma was present
892 -- in which case it points to the argument of the pragma, and the name can
893 -- be located as Chars (Expression (System_Extend_Pragma_Arg)).
895 System_Extend_Unit : Node_Id := Empty;
896 -- GNAT
897 -- This is set to Empty if GNAT_Mode is set, since pragma Extend_System
898 -- is never appropriate in GNAT_Mode (and causes troubles, including
899 -- bogus circularities, if we try to compile the run-time library with
900 -- a System extension). If GNAT_Mode is not set, then System_Extend_Unit
901 -- is a copy of the value set in System_Extend_Pragma_Arg.
903 Subunits_Missing : Boolean := False;
904 -- GNAT
905 -- This flag is set true if missing subunits are detected with code
906 -- generation active. This causes code generation to be skipped.
908 Suppress_Checks : Boolean := False;
909 -- GNAT
910 -- Set to True if -gnatp (suppress all checks) switch present.
912 Suppress_Options : Suppress_Array;
913 -- GNAT
914 -- Flags set True to suppress corresponding check, i.e. add an implicit
915 -- pragma Suppress at the outer level of each unit compiled. Note that
916 -- these suppress actions can be overridden by the use of the Unsuppress
917 -- pragma. This variable is initialized by Osint.Initialize.
919 Suppress_Back_Annotation : Boolean := False;
920 -- GNAT
921 -- This flag is set True if back annotation of representation information
922 -- is to be suppressed. This is set if neither -gnatt or -gnatR0-3 is set.
923 -- This avoids unnecessary time being spent on back annotation.
925 Table_Factor : Int := 1;
926 -- GNAT
927 -- Factor by which all initial table sizes set in Alloc are multiplied.
928 -- Used in Table to calculate initial table sizes (the initial table size
929 -- is the value in Alloc, used as the Table_Initial parameter value,
930 -- multiplied by the factor given here. The default value is used if no
931 -- -gnatT switch appears.
933 Task_Dispatching_Policy : Character := ' ';
934 -- GNAT, GNATBIND
935 -- Set to ' ' for the default case (no task dispatching policy specified).
936 -- Reset to first character (uppercase) of task dispatching policy name
937 -- if a valid Task_Dispatching_Policy pragma is encountered.
939 Task_Dispatching_Policy_Sloc : Source_Ptr := No_Location;
940 -- GNAT, GNATBIND
941 -- Remember location of previous Task_Dispatching_Policy pragma. This is
942 -- used for inconsistency error messages. A value of System_Location is
943 -- used if the policy is set in package System.
945 Tasking_Used : Boolean := False;
946 -- Set True if any tasking construct is encountered. Used to activate the
947 -- output of the Q, L and T lines in ALI files.
949 Time_Slice_Set : Boolean := False;
950 -- GNATBIND
951 -- Set True if a pragma Time_Slice is processed in the main unit, or
952 -- if the -gnatTnn switch is present to set a time slice value.
954 Time_Slice_Value : Nat;
955 -- GNATBIND
956 -- Time slice value. Valid only if Time_Slice_Set is True, i.e. if
957 -- Time_Slice pragma has been processed. Set to the time slice value in
958 -- microseconds. Negative values are stored as zero, and the value is not
959 -- larger than 1_000_000_000 (1000 seconds). Values larger than this are
960 -- reset to this maximum. This can also be set with the -gnatTnn switch.
962 Tolerate_Consistency_Errors : Boolean := False;
963 -- GNATBIND
964 -- Tolerate time stamp and other consistency errors. If this flag is set to
965 -- True (-t), then inconsistencies result in warnings rather than errors.
967 Tree_Output : Boolean := False;
968 -- GNAT
969 -- Set to True (-gnatt) to generate output tree file
971 Try_Semantics : Boolean := False;
972 -- GNAT
973 -- Flag set to force attempt at semantic analysis, even if parser errors
974 -- occur. This will probably cause blowups at this stage in the game. On
975 -- the other hand, most such blowups will be caught cleanly and simply
976 -- say compilation abandoned. This flag is set to True by -gnatq or -gnatQ.
978 Undefined_Symbols_Are_False : Boolean := False;
979 -- GNAT, GNATPREP
980 -- Set to True by switch -u of gnatprep or -u in the preprocessing data
981 -- file for the compiler. Indicates that while preprocessing sources,
982 -- symbols that are not defined have the value FALSE.
984 Unique_Error_Tag : Boolean := Tag_Errors;
985 -- GNAT
986 -- Indicates if error messages are to be prefixed by the string error:
987 -- Initialized from Tag_Errors, can be forced on with the -gnatU switch.
989 Universal_Addressing_On_AAMP : Boolean := False;
990 -- GNAAMP
991 -- Indicates if library-level objects should be accessed and updated using
992 -- universal addressing instructions on the AAMP architecture. This flag is
993 -- set to True when pragma Universal_Data is given as a configuration
994 -- pragma.
996 Unreserve_All_Interrupts : Boolean := False;
997 -- GNAT, GNATBIND
998 -- Normally set False, set True if a valid Unreserve_All_Interrupts pragma
999 -- appears anywhere in the main unit for GNAT, or if any ALI file has the
1000 -- corresponding attribute set in GNATBIND.
1002 Upper_Half_Encoding : Boolean := False;
1003 -- GNAT
1004 -- Normally set False, indicating that upper half ASCII characters are
1005 -- used in the normal way to represent themselves. If the wide character
1006 -- encoding method uses the upper bit for this encoding, then this flag is
1007 -- set True, and upper half characters in the source indicate the start of
1008 -- a wide character sequence.
1010 Usage_Requested : Boolean := False;
1011 -- GNAT, GNATBIND, GNATMAKE
1012 -- Set to True if -h (-gnath for the compiler) switch encountered
1013 -- requesting usage information
1015 Use_VADS_Size : Boolean := False;
1016 -- GNAT
1017 -- Set to True if a valid pragma Use_VADS_Size is processed
1019 Validity_Checks_On : Boolean := True;
1020 -- GNAT
1021 -- This flag determines if validity checking is on or off. The initial
1022 -- state is on, and the required default validity checks are active. The
1023 -- actual set of checks that is performed if Validity_Checks_On is set is
1024 -- defined by the switches in package Sem_Val. The Validity_Checks_On flag
1025 -- is controlled by pragma Validity_Checks (On | Off), and also some
1026 -- generated compiler code (typically code that has to do with validity
1027 -- check generation) is compiled with this flag set to False. This flag is
1028 -- set to False by the -gnatp switch.
1030 Verbose_Mode : Boolean := False;
1031 -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN
1032 -- Set to True to get verbose mode (full error message text and location
1033 -- information sent to standard output, also header, copyright and summary)
1035 Warn_On_Ada_2005_Compatibility : Boolean := True;
1036 -- GNAT
1037 -- Set to True to active all warnings on Ada 2005 compatibility issues,
1038 -- including warnings on Ada 2005 obsolescent features used in Ada 2005
1039 -- mode. Set False by -gnatwY.
1041 Warn_On_Bad_Fixed_Value : Boolean := False;
1042 -- GNAT
1043 -- Set to True to generate warnings for static fixed-point expression
1044 -- values that are not an exact multiple of the small value of the type.
1046 Warn_On_Constant : Boolean := False;
1047 -- GNAT
1048 -- Set to True to generate warnings for variables that could be declared
1049 -- as constants. Modified by use of -gnatwk/K.
1051 Warn_On_Dereference : Boolean := False;
1052 -- GNAT
1053 -- Set to True to generate warnings for implicit dereferences for array
1054 -- indexing and record component access. Modified by use of -gnatwd/D.
1056 Warn_On_Export_Import : Boolean := True;
1057 -- GNAT
1058 -- Set to True to generate warnings for suspicious use of export or
1059 -- import pragmas. Modified by use of -gnatwx/X.
1061 Warn_On_Hiding : Boolean := False;
1062 -- GNAT
1063 -- Set to True to generate warnings if a declared entity hides another
1064 -- entity. The default is that this warning is suppressed.
1066 Warn_On_Modified_Unread : Boolean := False;
1067 -- GNAT
1068 -- Set to True to generate warnings if a variable is assigned but is never
1069 -- read. The default is that this warning is suppressed.
1071 Warn_On_No_Value_Assigned : Boolean := True;
1072 -- GNAT
1073 -- Set to True to generate warnings if no value is ever assigned to a
1074 -- variable that is at least partially uninitialized. Set to false to
1075 -- suppress such warnings. The default is that such warnings are enabled.
1077 Warn_On_Obsolescent_Feature : Boolean := False;
1078 -- GNAT
1079 -- Set to True to generate warnings on use of any feature in Annex or if a
1080 -- subprogram is called for which a pragma Obsolescent applies.
1082 Warn_On_Redundant_Constructs : Boolean := False;
1083 -- GNAT
1084 -- Set to True to generate warnings for redundant constructs (e.g. useless
1085 -- assignments/conversions). The default is that this warning is disabled.
1087 Warn_On_Unchecked_Conversion : Boolean := True;
1088 -- GNAT
1089 -- Set to True to generate warnings for unchecked conversions that may have
1090 -- non-portable semantics (e.g. because sizes of types differ). The default
1091 -- is that this warning is enabled.
1093 Warn_On_Unrecognized_Pragma : Boolean := True;
1094 -- GNAT
1095 -- Set to True to generate warnings for unrecognized pragmas. The default
1096 -- is that this warning is enabled.
1098 type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
1099 Warning_Mode : Warning_Mode_Type := Normal;
1100 -- GNAT, GNATBIND
1101 -- Controls treatment of warning messages. If set to Suppress, warning
1102 -- messages are not generated at all. In Normal mode, they are generated
1103 -- but do not count as errors. In Treat_As_Error mode, warning messages
1104 -- are generated and are treated as errors.
1106 Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets;
1107 -- GNAT
1108 -- Method used for encoding wide characters in the source program. See
1109 -- description of type in unit System.WCh_Con for a list of the methods
1110 -- that are currently supported. Note that brackets notation is always
1111 -- recognized in source programs regardless of the setting of this
1112 -- variable. The default setting causes only the brackets notation to be
1113 -- recognized. If this is the main unit, this setting also controls the
1114 -- output of the W=? parameter in the ALI file, which is used to provide
1115 -- the default for Wide_Text_IO files.
1117 Xref_Active : Boolean := True;
1118 -- GNAT
1119 -- Set if cross-referencing is enabled (i.e. xref info in ALI files)
1121 Zero_Cost_Exceptions_Val : Boolean;
1122 Zero_Cost_Exceptions_Set : Boolean := False;
1123 -- GNAT
1124 -- These values are to record the setting of the zero cost exception
1125 -- handling mode set by argument switches (-gnatZ/-gnatL). If the value is
1126 -- set by one of these switches, then Zero_Cost_Exceptions_Set is set to
1127 -- True, and Zero_Cost_Exceptions_Val indicates the setting.
1129 ----------------------------
1130 -- Configuration Settings --
1131 ----------------------------
1133 -- These are settings that are used to establish the mode at the start of
1134 -- each unit. The values defined below can be affected either by command
1135 -- line switches, or by the use of appropriate configuration pragmas in the
1136 -- gnat.adc file.
1138 Ada_Version_Config : Ada_Version_Type;
1139 -- GNAT
1140 -- This is the value of the configuration switch for the Ada 83 mode, as
1141 -- set by the command line switches -gnat83/95/05, and possibly modified by
1142 -- the use of configuration pragmas Ada_83/Ada95/Ada05. This switch is used
1143 -- to set the initial value for Ada_Version mode at the start of analysis
1144 -- of a unit. Note however, that the setting of this flag is ignored for
1145 -- internal and predefined units (which are always compiled in the most up
1146 -- to date version of Ada).
1148 Ada_Version_Explicit_Config : Ada_Version_Type;
1149 -- GNAT
1150 -- Same as above but used to initialize Ada_Version_Explicit. Currently
1151 -- this will always have the same value as Ada_Version_Config.
1153 Assertions_Enabled_Config : Boolean;
1154 -- GNAT
1155 -- This is the value of the configuration switch for assertions enabled
1156 -- mode, as possibly set by the command line switch -gnata, and possibly
1157 -- modified by the use of the configuration pragma Assertion_Policy.
1159 Dynamic_Elaboration_Checks_Config : Boolean := False;
1160 -- GNAT
1161 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
1162 -- switch or by the use of pragma Elaboration_Checking (Dynamic).
1164 Exception_Locations_Suppressed_Config : Boolean := False;
1165 -- GNAT
1166 -- Set True by use of the configuration pragma Suppress_Exception_Messages
1168 Extensions_Allowed_Config : Boolean;
1169 -- GNAT
1170 -- This is the flag that indicates whether extensions are allowed. It can
1171 -- be set True either by use of the -gnatX switch, or by use of the
1172 -- configuration pragma Extensions_Allowed (On). It is always set to True
1173 -- for internal GNAT units, since extensions are always permitted in such
1174 -- units.
1176 External_Name_Exp_Casing_Config : External_Casing_Type;
1177 -- GNAT
1178 -- This is the value of the configuration switch that controls casing of
1179 -- external symbols for which an explicit external name is given. It can be
1180 -- set to Uppercase by the command line switch -gnatF, and further modified
1181 -- by the use of the configuration pragma External_Name_Casing in the
1182 -- gnat.adc file. This flag is used to set the initial value for
1183 -- External_Name_Exp_Casing at the start of analyzing each unit. Note
1184 -- however that the setting of this flag is ignored for internal and
1185 -- predefined units (which are always compiled with As_Is mode).
1187 External_Name_Imp_Casing_Config : External_Casing_Type;
1188 -- GNAT
1189 -- This is the value of the configuration switch that controls casing of
1190 -- external symbols where the external name is implicitly given. It can be
1191 -- set to Uppercase by the command line switch -gnatF, and further modified
1192 -- by the use of the configuration pragma External_Name_Casing in the
1193 -- gnat.adc file. This flag is used to set the initial value for
1194 -- External_Name_Imp_Casing at the start of analyzing each unit. Note
1195 -- however that the setting of this flag is ignored for internal and
1196 -- predefined units (which are always compiled with Lowercase mode).
1198 Persistent_BSS_Mode_Config : Boolean;
1199 -- GNAT
1200 -- This is the value of the configuration switch that controls whether
1201 -- potentially persistent data is to be placed in the persistent_bss
1202 -- section. It can be set True by use of the pragma Persistent_BSS.
1203 -- This flag is used to set the initial value of Persistent_BSS_Mode
1204 -- at the start of each compilation unit, except that it is always
1205 -- set False for predefined units.
1207 Polling_Required_Config : Boolean;
1208 -- GNAT
1209 -- This is the value of the configuration switch that controls polling
1210 -- mode. It can be set True by the command line switch -gnatP, and then
1211 -- further modified by the use of pragma Polling in the gnat.adc file. This
1212 -- flag is used to set the initial value for Polling_Required at the start
1213 -- of analyzing each unit.
1215 Use_VADS_Size_Config : Boolean;
1216 -- GNAT
1217 -- This is the value of the configuration switch that controls the use of
1218 -- VADS_Size instead of Size whereever the attribute Size is used. It can
1219 -- be set True by the use of the pragma Use_VADS_Size in the gnat.adc file.
1220 -- This flag is used to set the initial value for Use_VADS_Size at the
1221 -- start of analyzing each unit. Note however that the setting of this flag
1222 -- is ignored for internal and predefined units (which are always compiled
1223 -- with the standard Size semantics).
1225 type Config_Switches_Type is private;
1226 -- Type used to save values of the switches set from Config values
1228 procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type);
1229 -- This procedure saves the current values of the switches which are
1230 -- initialized from the above Config values, and then resets these switches
1231 -- according to the Config value settings.
1233 procedure Set_Opt_Config_Switches (Internal_Unit : Boolean);
1234 -- This procedure sets the switches to the appropriate initial values. The
1235 -- parameter Internal_Unit is True for an internal or predefined unit, and
1236 -- affects the way the switches are set (see above).
1238 procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
1239 -- This procedure restores a set of switch values previously saved by a
1240 -- call to Save_Opt_Switches.
1242 procedure Register_Opt_Config_Switches;
1243 -- This procedure is called after processing the gnat.adc file to record
1244 -- the values of the Config switches, as possibly modified by the use of
1245 -- command line switches and configuration pragmas.
1247 ------------------------
1248 -- Other Global Flags --
1249 ------------------------
1251 Expander_Active : Boolean := False;
1252 -- A flag that indicates if expansion is active (True) or deactivated
1253 -- (False). When expansion is deactivated all calls to expander routines
1254 -- have no effect. Note that the initial setting of False is merely to
1255 -- prevent saving of an undefined value for an initial call to the
1256 -- Expander_Mode_Save_And_Set procedure. For more information on the use of
1257 -- this flag, see package Expander. Indeed this flag might more logically
1258 -- be in the spec of Expander, but it is referenced by Errout, and it
1259 -- really seems wrong for Errout to depend on Expander.
1261 -----------------------
1262 -- Tree I/O Routines --
1263 -----------------------
1265 procedure Tree_Read;
1266 -- Reads switch settings from current tree file using Tree_Read
1268 procedure Tree_Write;
1269 -- Writes out switch settings to current tree file using Tree_Write
1271 --------------------------
1272 -- ASIS Version Control --
1273 --------------------------
1275 -- These two variables (Tree_Version_String and Tree_ASIS_Version_Number)
1276 -- are supposed to be used in the GNAT/ASIS version check performed in
1277 -- the ASIS code (this package is also a part of the ASIS implementation).
1278 -- They are set by Tree_Read procedure, so they represent the version
1279 -- number (and the version string) of the compiler which has created the
1280 -- tree, and they are supposed to be compared with the corresponding values
1281 -- from the Gnatvsn package which is a part of ASIS implementation.
1283 Tree_Version_String : String (Gnat_Version_String'Range);
1284 -- Used to store the compiler version string read from a tree file to check
1285 -- if it is the same as stored in the version string in Gnatvsn. Therefore
1286 -- its length is taken directly from the version string in Gnatvsn. If the
1287 -- length of the version string stored in the tree is different, then
1288 -- versions are for sure different, and a string containing '?' characters
1289 -- is assigned to this variable as a result of tree read.
1291 Tree_ASIS_Version_Number : Int;
1292 -- Used to store the ASIS version number read from a tree file to check if
1293 -- it is the same as stored in the ASIS version number in Gnatvsn.
1295 private
1297 type Config_Switches_Type is record
1298 Ada_Version : Ada_Version_Type;
1299 Ada_Version_Explicit : Ada_Version_Type;
1300 Assertions_Enabled : Boolean;
1301 Dynamic_Elaboration_Checks : Boolean;
1302 Exception_Locations_Suppressed : Boolean;
1303 Extensions_Allowed : Boolean;
1304 External_Name_Exp_Casing : External_Casing_Type;
1305 External_Name_Imp_Casing : External_Casing_Type;
1306 Persistent_BSS_Mode : Boolean;
1307 Polling_Required : Boolean;
1308 Use_VADS_Size : Boolean;
1309 end record;
1311 end Opt;