]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/opt.ads
2010-10-11 Bob Duff <duff@adacore.com>
[thirdparty/gcc.git] / gcc / ada / opt.ads
CommitLineData
83cce46b 1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- O P T --
6-- --
7-- S p e c --
8-- --
06e076c6 9-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
83cce46b 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- --
6bc9506f 13-- ware Foundation; either version 3, or (at your option) any later ver- --
83cce46b 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 --
6bc9506f 16-- or FITNESS FOR A PARTICULAR PURPOSE. --
17-- --
18-- As a special exception under Section 7 of GPL version 3, you are granted --
19-- additional permissions described in the GCC Runtime Library Exception, --
20-- version 3.1, as published by the Free Software Foundation. --
21-- --
22-- You should have received a copy of the GNU General Public License and --
23-- a copy of the GCC Runtime Library Exception along with this program; --
24-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25-- <http://www.gnu.org/licenses/>. --
83cce46b 26-- --
27-- GNAT was originally developed by the GNAT team at New York University. --
e78e8c8e 28-- Extensive contributions were provided by Ada Core Technologies Inc. --
83cce46b 29-- --
30------------------------------------------------------------------------------
31
0bba2a3e 32-- This package contains global flags set by the initialization routine from
33-- the command line and referenced throughout the compiler, the binder, or
34-- other GNAT tools. The comments indicate which options are used by which
43052740 35-- programs (GNAT, GNATBIND, GNATLINK, GNATMAKE, GPRMAKE, etc).
83cce46b 36
9c5da18f 37-- Some flags are labelled "PROJECT MANAGER". These are used by tools that
38-- use the Project Manager. These tools include gnatmake, gnatname, the gnat
39-- driver, gnatclean, gprbuild and gprclean.
40
9dfe12ae 41with Hostparm; use Hostparm;
42with Types; use Types;
43
3f8cf2d2 44pragma Warnings (Off);
45-- This package is used also by gnatcoll
8255b799 46with System.Strings; use System.Strings;
83cce46b 47with System.WCh_Con; use System.WCh_Con;
3f8cf2d2 48pragma Warnings (On);
83cce46b 49
50package Opt is
51
52 ----------------------------------------------
53 -- Settings of Modes for Current Processing --
54 ----------------------------------------------
55
56 -- The following mode values represent the current state of processing.
57 -- The values set here are the default values. Unless otherwise noted,
27f48659 58 -- the value may be reset in Switch-? with an appropriate switch. In
83cce46b 59 -- some cases, the values can also be modified by pragmas, and in the
60 -- case of some binder variables, Gnatbind.Scan_Bind_Arg may modify
61 -- the default values.
62
63 Ada_Bind_File : Boolean := True;
f15731c4 64 -- GNATBIND, GNATLINK
83cce46b 65 -- Set True if binder file to be generated in Ada rather than C
66
ad8b87c8 67 type Ada_Version_Type is (Ada_83, Ada_95, Ada_05, Ada_2012);
a22215d6 68 pragma Ordered (Ada_Version_Type);
e2aa7314 69 -- Versions of Ada for Ada_Version below. Note that these are ordered,
70 -- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
71
571bfaf5 72 Ada_2005 : Ada_Version_Type renames Ada_05;
ad8b87c8 73 -- Renaming with full name (preferred usage)
571bfaf5 74
925c2ba1 75 Ada_Version_Default : constant Ada_Version_Type := Ada_05;
5779992c 76 pragma Warnings (Off, Ada_Version_Default);
83cce46b 77 -- GNAT
5779992c 78 -- Default Ada version if no switch given. The Warnings off is to kill
79 -- constant condition warnings.
7800b920 80 --
81 -- WARNING: some scripts rely on the format of this line of code. Any
82 -- change must be coordinated with the scripts requirements.
83cce46b 83
e2aa7314 84 Ada_Version : Ada_Version_Type := Ada_Version_Default;
83cce46b 85 -- GNAT
0bba2a3e 86 -- Current Ada version for compiler, as set by configuration pragmas,
87 -- compiler switches, or implicitly (to Ada_Version_Runtime) when a
88 -- predefined or internal file is compiled.
89
90 Ada_Version_Explicit : Ada_Version_Type := Ada_Version_Default;
91 -- GNAT
92 -- Like Ada_Version, but does not get set implicitly for predefined
93 -- or internal units, so it reflects the Ada version explicitly set
94 -- using configuration pragmas or compiler switches (or if neither
95 -- appears, it remains set to Ada_Version_Default). This is used in
96 -- the rare cases (notably for pragmas Preelaborate_05 and Pure_05)
97 -- where in the run-time we want the explicit version set.
83cce46b 98
ad8b87c8 99 Ada_Version_Runtime : Ada_Version_Type := Ada_2012;
44d43e97 100 -- GNAT
0bba2a3e 101 -- Ada version used to compile the runtime. Used to set Ada_Version (but
102 -- not Ada_Version_Explicit) when compiling predefined or internal units.
44d43e97 103
83cce46b 104 Ada_Final_Suffix : constant String := "final";
2e12de5f 105 Ada_Final_Name : String_Ptr := new String'("ada" & Ada_Final_Suffix);
83cce46b 106 -- GNATBIND
107 -- The name of the procedure that performs the finalization at the end of
108 -- execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
109
110 Ada_Init_Suffix : constant String := "init";
2e12de5f 111 Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix);
83cce46b 112 -- GNATBIND
113 -- The name of the procedure that performs initialization at the start
114 -- of execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
115
116 Ada_Main_Name_Suffix : constant String := "main";
117 -- GNATBIND
118 -- The suffix for Ada_Main_Name. Defined as a constant here so that it
119 -- can be referenced in a uniform manner to create either the default
120 -- value of Ada_Main_Name (declared below), or the non-default name
121 -- set by Gnatbind.Scan_Bind_Arg.
122
123 Ada_Main_Name : String_Ptr := new String'("ada_" & Ada_Main_Name_Suffix);
124 -- GNATBIND
125 -- The name of the Ada package generated by the binder (when in Ada mode).
126 -- This variable may be modified by Gnatbind.Scan_Bind_Arg.
127
128 Address_Clause_Overlay_Warnings : Boolean := True;
129 -- GNAT
130 -- Set False to disable address clause warnings
131
d8ede95f 132 Address_Is_Private : Boolean := False;
133 -- GNAT, GNATBIND
134 -- Set True if package System has the line "type Address is private;"
135
83cce46b 136 All_Errors_Mode : Boolean := False;
137 -- GNAT
138 -- Flag set to force display of multiple errors on a single line and
139 -- also repeated error messages for references to undefined identifiers
3a838102 140 -- and certain other repeated error messages. Set by use of -gnatf.
83cce46b 141
142 All_Sources : Boolean := False;
143 -- GNATBIND
144 -- Set to True to require all source files to be present. This flag is
145 -- directly modified by gnatmake to affect the shared binder routines.
146
147 Alternate_Main_Name : String_Ptr := null;
f15731c4 148 -- GNATBIND
83cce46b 149 -- Set to non null when Bind_Alternate_Main_Name is True. This value
150 -- is modified as needed by Gnatbind.Scan_Bind_Arg.
151
9dfe12ae 152 ASIS_Mode : Boolean := False;
153 -- GNAT
154 -- Enable semantic checks and tree transformations that are important
155 -- for ASIS but that are usually skipped if Operating_Mode is set to
156 -- Check_Semantics. This flag does not have the corresponding option to set
157 -- it ON. It is set ON when Tree_Output is set ON, it can also be set ON
158 -- from the code of GNSA-based tool (a client may need to set ON the
159 -- Back_Annotate_Rep_Info flag in this case. At the moment this does not
43052740 160 -- make very much sense, because GNSA cannot do back annotation).
9dfe12ae 161
f815903c 162 Assertions_Enabled : Boolean := False;
163 -- GNAT
164 -- Enable assertions made using pragma Assert
165
9c486805 166 Assume_No_Invalid_Values : Boolean := False;
c9e9428a 167 -- GNAT
bf3e1520 168 -- Normally, in accordance with (RM 13.9.1 (9-11)) the front end assumes
c9e9428a 169 -- that values could have invalid representations, unless it can clearly
170 -- prove that the values are valid. If this switch is set (by -gnatB or by
171 -- pragma Assume_No_Invalid_Values (Off)), then the compiler assumes values
9c486805 172 -- are valid and in range of their representations. This feature is now
173 -- fully enabled in the compiler.
c9e9428a 174
83cce46b 175 Back_Annotate_Rep_Info : Boolean := False;
176 -- GNAT
9dfe12ae 177 -- If set True, enables back annotation of representation information
178 -- by gigi, even in -gnatc mode. This is set True by the use of -gnatR
179 -- (list representation information) or -gnatt (generate tree). It is
180 -- also set true if certain Unchecked_Conversion instantiations require
181 -- checking based on annotated values.
83cce46b 182
c9e3ee19 183 Back_End_Handles_Limited_Types : Boolean;
184 -- This flag is set true if the back end can properly handle limited or
185 -- other by reference types, and avoid copies. If this flag is False, then
186 -- the front end does special expansion for conditional expressions to make
187 -- sure that no copy occurs. If the flag is True, then the expansion for
188 -- conditional expressions relies on the back end properly handling things.
189 -- Currently the default is False for all cases (set in gnat1drv). The
190 -- default can be modified using -gnatd.L (sets the flag True).
191
83cce46b 192 Bind_Alternate_Main_Name : Boolean := False;
193 -- GNATBIND
f15731c4 194 -- True if main should be called Alternate_Main_Name.all.
195 -- This variable may be set to True by Gnatbind.Scan_Bind_Arg.
83cce46b 196
197 Bind_Main_Program : Boolean := True;
198 -- GNATBIND
0bba2a3e 199 -- Set to False if not binding main Ada program
83cce46b 200
201 Bind_For_Library : Boolean := False;
202 -- GNATBIND
950e1932 203 -- Set to True if the binder needs to generate a file designed for building
204 -- a library. May be set to True by Gnatbind.Scan_Bind_Arg.
83cce46b 205
9d40d585 206 Bind_Only : Boolean := False;
9c5da18f 207 -- GNATMAKE, GPRMAKE, GPRBUILD
9d40d585 208 -- Set to True to skip compile and link steps
209 -- (except when Compile_Only and/or Link_Only are True).
210
9dfe12ae 211 Blank_Deleted_Lines : Boolean := False;
212 -- GNAT, GNATPREP
213 -- Output empty lines for each line of preprocessed input that is deleted
214 -- in the output, including preprocessor lines starting with a '#'.
215
83cce46b 216 Brief_Output : Boolean := False;
217 -- GNAT, GNATBIND
218 -- Force brief error messages to standard error, even if verbose mode is
219 -- set (so that main error messages go to standard output).
220
5c61a0ff 221 Build_Bind_And_Link_Full_Project : Boolean := False;
222 -- GNATMAKE
223 -- Set to True to build, bind and link all the sources of a project file
224 -- (switch -B)
225
83cce46b 226 Check_Object_Consistency : Boolean := False;
227 -- GNATBIND, GNATMAKE
228 -- Set to True to check whether every object file is consistent with
f15731c4 229 -- its corresponding ada library information (ALI) file. An object
230 -- file is inconsistent with the corresponding ALI file if the object
231 -- file does not exist or if it has an older time stamp than the ALI file.
83cce46b 232 -- Default above is for GNATBIND. GNATMAKE overrides this default to
f15731c4 233 -- True (see Make.Initialize) since we normally do need to check source
234 -- consistencies in gnatmake.
83cce46b 235
236 Check_Only : Boolean := False;
237 -- GNATBIND
0bba2a3e 238 -- Set to True to do checks only, no output of binder file
83cce46b 239
3a2db8ab 240 Check_Policy_List : Node_Id := Empty;
241 -- GNAT
242 -- This points to the list of N_Pragma nodes for Check_Policy pragmas
243 -- that are linked through the Next_Pragma fields, with the list being
006b904a 244 -- terminated by Empty. The order is most recently processed first. Note
245 -- that Push_Scope and Pop_Scope in Sem_Ch8 save and restore the value
246 -- of this variable, implementing the required scope control for pragmas
247 -- appearing a declarative part.
3a2db8ab 248
83cce46b 249 Check_Readonly_Files : Boolean := False;
250 -- GNATMAKE
0bba2a3e 251 -- Set to True to check readonly files during the make process
83cce46b 252
253 Check_Source_Files : Boolean := True;
f15731c4 254 -- GNATBIND, GNATMAKE
83cce46b 255 -- Set to True to enable consistency checking for any source files that
256 -- are present (i.e. date must match the date in the library info file).
257 -- Set to False for object file consistency check only. This flag is
258 -- directly modified by gnatmake, to affect the shared binder routines.
259
260 Check_Switches : Boolean := False;
9c5da18f 261 -- GNATMAKE, GPRMAKE, GPBUILD
0bba2a3e 262 -- Set to True to check compiler options during the make process
83cce46b 263
264 Check_Unreferenced : Boolean := False;
265 -- GNAT
f15731c4 266 -- Set to True to enable checking for unreferenced entities other
267 -- than formal parameters (for which see Check_Unreferenced_Formals)
268
269 Check_Unreferenced_Formals : Boolean := False;
270 -- GNAT
0bba2a3e 271 -- Set True to check for unreferenced formals. This is turned on by
272 -- -gnatwa/wf/wu and turned off by -gnatwA/wF/wU.
83cce46b 273
274 Check_Withs : Boolean := False;
275 -- GNAT
276 -- Set to True to enable checking for unused withs, and also the case
277 -- of withing a package and using none of the entities in the package.
278
9af0ddc7 279 CodePeer_Mode : Boolean := False;
280 -- GNAT
281 -- Enable full CodePeer mode (SCIL generation, disable switches that
282 -- interact badly with it, etc...).
283
3a838102 284 Commands_To_Stdout : Boolean := False;
285 -- GNATMAKE
286 -- True if echoed commands to be written to stdout instead of stderr
287
9dfe12ae 288 Comment_Deleted_Lines : Boolean := False;
289 -- GNATPREP
290 -- True if source lines removed by the preprocessor should be commented
291 -- in the output file.
83cce46b 292
9dfe12ae 293 Compile_Only : Boolean := False;
9c5da18f 294 -- GNATMAKE, GNATCLEAN, GPRMAKE, GPBUILD, GPRCLEAN
295 -- GNATMAKE, GPRMAKE, GPRMAKE:
296 -- set to True to skip bind and link steps (except when Bind_Only is
297 -- True).
298 -- GNATCLEAN, GPRCLEAN:
299 -- set to True to delete only the files produced by the compiler but not
300 -- the library files or the executable files.
83cce46b 301
302 Config_File : Boolean := True;
303 -- GNAT
304 -- Set to False to inhibit reading and processing of gnat.adc file
305
9dfe12ae 306 Config_File_Names : String_List_Access := null;
83cce46b 307 -- GNAT
9dfe12ae 308 -- Names of configuration pragmas files (given by switches -gnatec)
309
310 Configurable_Run_Time_Mode : Boolean := False;
311 -- GNAT, GNATBIND
312 -- Set True if the compiler is operating in configurable run-time mode.
313 -- This happens if the flag Targparm.Configurable_Run_TimeMode_On_Target
314 -- is set True, or if pragma No_Run_Time is used. See the spec of Rtsfind
315 -- for details on the handling of the latter pragma.
83cce46b 316
317 Constant_Condition_Warnings : Boolean := False;
318 -- GNAT
319 -- Set to True to activate warnings on constant conditions
320
f15731c4 321 Create_Mapping_File : Boolean := False;
43052740 322 -- GNATMAKE, GPRMAKE
323 -- Set to True (-C switch) to indicate that the compiler will be invoked
324 -- with a mapping file (-gnatem compiler switch).
f15731c4 325
5c6363c7 326 Debug_Pragmas_Enabled : Boolean := False;
327 -- GNAT
328 -- Enable debug statements from pragma Debug
329
83cce46b 330 subtype Debug_Level_Value is Nat range 0 .. 3;
331 Debugger_Level : Debug_Level_Value := 0;
332 -- GNATBIND
80d4fec4 333 -- The value given to the -g parameter. The default value for -g with
334 -- no value is 2. This is usually ignored by GNATBIND, except in the
335 -- VMS version where it is passed as an argument to __gnat_initialize
336 -- to trigger the activation of the remote debugging interface.
337 -- Is this still true ???
83cce46b 338
339 Debug_Generated_Code : Boolean := False;
340 -- GNAT
341 -- Set True (-gnatD switch) to debug generated expanded code instead
342 -- of the original source code. Causes debugging information to be
343 -- written with respect to the generated code file that is written.
344
7189d17f 345 Default_Exit_Status : Int := 0;
346 -- GNATBIND
347 -- Set the default exit status value. Set by the -Xnnn switch for the
348 -- binder.
349
2e12de5f 350 Default_Stack_Size : Int := -1;
351 -- GNATBIND
352 -- Set to default primary stack size in units of bytes. Set by
353 -- the -dnnn switch for the binder. A value of -1 indicates that no
354 -- default was set by the binder.
355
5c61a0ff 356 Default_Sec_Stack_Size : Int := -1;
357 -- GNATBIND
2e12de5f 358 -- Set to default secondary stack size in units of bytes. Set by
5c61a0ff 359 -- the -Dnnn switch for the binder. A value of -1 indicates that no
360 -- default was set by the binder, and that the default should be the
361 -- initial value of System.Secondary_Stack.Default_Secondary_Stack_Size.
362
80d4fec4 363 Detect_Blocking : Boolean := False;
364 -- GNAT
365 -- Set True to force the run time to raise Program_Error if calls to
366 -- potentially blocking operations are detected from protected actions.
367
83cce46b 368 Display_Compilation_Progress : Boolean := False;
9c5da18f 369 -- GNATMAKE, GPRMAKE, GPRBUILD
83cce46b 370 -- Set True (-d switch) to display information on progress while compiling
80d4fec4 371 -- files. Internal flag to be used in conjunction with an IDE (e.g GPS).
83cce46b 372
373 type Distribution_Stub_Mode_Type is
374 -- GNAT
375 (No_Stubs,
376 -- Normal mode, no generation/compilation of distribution stubs
377
378 Generate_Receiver_Stub_Body,
379 -- The unit being compiled is the RCI body, and the compiler will
380 -- generate the body for the receiver stubs and compile it.
381
382 Generate_Caller_Stub_Body);
383 -- The unit being compiled is the RCI spec, and the compiler will
384 -- generate the body for the caller stubs and compile it.
385
386 Distribution_Stub_Mode : Distribution_Stub_Mode_Type := No_Stubs;
387 -- GNAT
388 -- This enumeration variable indicates the five states of distribution
389 -- annex stub generation/compilation.
390
391 Do_Not_Execute : Boolean := False;
392 -- GNATMAKE
393 -- Set to True if no actual compilations should be undertaken.
394
3a838102 395 Dump_Source_Text : Boolean := False;
396 -- GNAT
397 -- Set to True (by -gnatL) to dump source text intermingled with generated
398 -- code. Effective only if either of Debug/Print_Generated_Code is true.
399
83cce46b 400 Dynamic_Elaboration_Checks : Boolean := False;
401 -- GNAT
402 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
403 -- switch or by the use of pragma Elaboration_Checks (Dynamic).
404
0b8fc818 405 Dynamic_Stack_Measurement : Boolean := False;
406 -- GNATBIND
407 -- Set True to enable dynamic stack measurement (-u flag for gnatbind)
408
409 Dynamic_Stack_Measurement_Array_Size : Nat := 100;
410 -- GNATBIND
411 -- Number of measurements we want to store during dynamic stack analysis.
412 -- When the buffer is full, non-storable results will be output on the fly.
413 -- The value is relevant only if Dynamic_Stack_Measurement is set. Set
414 -- by processing of -u flag for gnatbind.
415
83cce46b 416 Elab_Dependency_Output : Boolean := False;
417 -- GNATBIND
418 -- Set to True to output complete list of elaboration constraints
419
420 Elab_Order_Output : Boolean := False;
421 -- GNATBIND
422 -- Set to True to output chosen elaboration order
423
424 Elab_Warnings : Boolean := False;
425 -- GNAT
426 -- Set to True to generate full elaboration warnings (-gnatwl)
427
f15731c4 428 Enable_Overflow_Checks : Boolean := False;
429 -- GNAT
430 -- Set to True if -gnato (enable overflow checks) switch is set,
431 -- but not -gnatp.
432
3a838102 433 Error_Msg_Line_Length : Nat := 0;
434 -- GNAT
435 -- Records the error message line length limit. If this is set to zero,
436 -- then we get the old style behavior, in which each call to the error
437 -- message routines generates one line of output as a separate message.
438 -- If it is set to a non-zero value, then continuation lines are folded
439 -- to make a single long message, and then this message is split up into
3a2db8ab 440 -- multiple lines not exceeding the specified length. Set by -gnatj=nn.
3a838102 441
30e5c8d3 442 Exception_Handler_Encountered : Boolean := False;
443 -- GNAT
444 -- This flag is set true if the parser encounters an exception handler.
445 -- It is used to set Warn_On_Exception_Propagation True if the restriction
446 -- No_Exception_Propagation is set.
447
9dfe12ae 448 Exception_Locations_Suppressed : Boolean := False;
449 -- GNAT
450 -- This flag is set True if a Suppress_Exception_Locations configuration
451 -- pragma is currently active.
452
453 type Exception_Mechanism_Type is
454 -- Determines the handling of exceptions. See Exp_Ch11 for details
455 --
456 (Front_End_Setjmp_Longjmp_Exceptions,
457 -- Exceptions use setjmp/longjmp generated explicitly by the
458 -- front end (this includes gigi or other equivalent parts of
459 -- the code generator). AT END handlers are converted into
460 -- exception handlers by the front end in this mode.
461
5c6363c7 462 Back_End_Exceptions);
9dfe12ae 463 -- Exceptions are handled by the back end. The front end simply
464 -- generates the handlers as they appear in the source, and AT
465 -- END handlers are left untouched (they are not converted into
5c6363c7 466 -- exception handlers when operating in this mode.
f15731c4 467 pragma Convention (C, Exception_Mechanism_Type);
468
9dfe12ae 469 Exception_Mechanism : Exception_Mechanism_Type :=
470 Front_End_Setjmp_Longjmp_Exceptions;
83cce46b 471 -- GNAT
472 -- Set to the appropriate value depending on the default as given in
06e076c6 473 -- system.ads (ZCX_By_Default, GCC_ZCX_Support). The C convention is there
474 -- to make this variable accessible to gigi.
83cce46b 475
476 Exception_Tracebacks : Boolean := False;
477 -- GNATBIND
478 -- Set to True to store tracebacks in exception occurrences (-E)
479
480 Extensions_Allowed : Boolean := False;
481 -- GNAT
f15731c4 482 -- Set to True by switch -gnatX if GNAT specific language extensions
59ac57b5 483 -- are allowed. For example, the use of 'Constrained with objects of
484 -- generic types is a GNAT extension.
83cce46b 485
486 type External_Casing_Type is (
487 As_Is, -- External names cased as they appear in the Ada source
488 Uppercase, -- External names forced to all uppercase letters
489 Lowercase); -- External names forced to all lowercase letters
490
491 External_Name_Imp_Casing : External_Casing_Type := Lowercase;
f15731c4 492 -- GNAT
493 -- The setting of this flag determines the casing of external names
83cce46b 494 -- when the name is implicitly derived from an entity name (i.e. either
495 -- no explicit External_Name or Link_Name argument is used, or, in the
496 -- case of extended DEC pragmas, the external name is given using an
497 -- identifier. The As_Is setting is not permitted here (since this would
498 -- create Ada source programs that were case sensitive).
499
500 External_Name_Exp_Casing : External_Casing_Type := As_Is;
f15731c4 501 -- GNAT
502 -- The setting of this flag determines the casing of an external name
83cce46b 503 -- specified explicitly with a string literal. As_Is means the string
504 -- literal is used as given with no modification to the casing. If
505 -- Lowercase or Uppercase is set, then the string is forced to all
506 -- lowercase or all uppercase letters as appropriate. Note that this
507 -- setting has no effect if the external name is given using an identifier
508 -- in the case of extended DEC import/export pragmas (in this case the
509 -- casing is controlled by External_Name_Imp_Casing), and also has no
510 -- effect if an explicit Link_Name is supplied (a link name is always
511 -- used exactly as given).
512
e161d1a3 513 External_Unit_Compilation_Allowed : Boolean := False;
514 -- GNATMAKE
515 -- When True (set by gnatmake switch -x), allow compilation of sources
516 -- that are not part of any project file.
517
9c5da18f 518 Fast_Math : Boolean := False;
519 -- GNAT
520 -- Indicates the current setting of Fast_Math mode, as set by the use
521 -- of a Fast_Math pragma (set on by Fast_Math (On)).
522
83cce46b 523 Float_Format : Character := ' ';
524 -- GNAT
525 -- A non-blank value indicates that a Float_Format pragma has been
526 -- processed, in which case this variable is set to 'I' for IEEE or
527 -- to 'V' for VAX. The setting of 'V' is only possible on OpenVMS
528 -- versions of GNAT.
529
530 Float_Format_Long : Character := ' ';
531 -- GNAT
532 -- A non-blank value indicates that a Long_Float pragma has been
533 -- processed (this pragma is recognized only in OpenVMS versions
534 -- of GNAT), in which case this variable is set to D or G for
535 -- D_Float or G_Float.
536
537 Force_ALI_Tree_File : Boolean := False;
538 -- GNAT
f15731c4 539 -- Force generation of ALI file even if errors are encountered.
83cce46b 540 -- Also forces generation of tree file if -gnatt is also set.
541
9dfe12ae 542 Force_Checking_Of_Elaboration_Flags : Boolean := False;
543 -- GNATBIND
544 -- True if binding with forced checking of the elaboration flags
545 -- (-F switch set).
546
83cce46b 547 Force_Compilations : Boolean := False;
9c5da18f 548 -- GNATMAKE, GPRMAKE, GPRBUILD
83cce46b 549 -- Set to force recompilations even when the objects are up-to-date.
550
9dfe12ae 551 Full_Path_Name_For_Brief_Errors : Boolean := False;
9c5da18f 552 -- PROJECT MANAGER
9dfe12ae 553 -- When True, in Brief_Output mode, each error message line
554 -- will start with the full path name of the source.
555 -- When False, only the file name without directory information
556 -- is used.
557
83cce46b 558 Full_List : Boolean := False;
559 -- GNAT
560 -- Set True to generate full source listing with embedded errors
561
3a838102 562 Full_List_File_Name : String_Ptr := null;
563 -- GNAT
564 -- Set to file name to generate full source listing to named file (or if
565 -- the name is of the form .xxx, then to name.xxx where name is the source
566 -- file name with extension stripped.
567
938d8e9f 568 Generate_Processed_File : Boolean := False;
569 -- GNAT
570 -- True when switch -gnateG is used. When True, create in a file
571 -- <source>.prep, if the source is preprocessed.
572
902e2182 573 Generate_SCO : Boolean := False;
574 -- GNAT
575 -- True when switch -gnateS is used. When True, Source Coverage Obligation
576 -- (SCO) information is generated and output in the ALI file. See unit
1a8bc727 577 -- Par_SCO for full details.
902e2182 578
8255b799 579 Generating_Code : Boolean := False;
580 -- GNAT
581 -- True if the frontend finished its work and has called the backend to
27f48659 582 -- process the tree and generate the object file.
0914a918 583
83cce46b 584 Global_Discard_Names : Boolean := False;
9dfe12ae 585 -- GNAT, GNATBIND
8255b799 586 -- True if a pragma Discard_Names appeared as a configuration pragma for
587 -- the current compilation unit.
83cce46b 588
589 GNAT_Mode : Boolean := False;
590 -- GNAT
f15731c4 591 -- True if compiling in GNAT system mode (-gnatg switch)
83cce46b 592
92940d4e 593 Heap_Size : Nat := 0;
594 -- GNATBIND
595 -- Heap size for memory allocations. Valid values are 32 and 64. Only
596 -- available on VMS.
597
83cce46b 598 HLO_Active : Boolean := False;
599 -- GNAT
f15731c4 600 -- True if High Level Optimizer is activated (-gnatH switch)
83cce46b 601
83cce46b 602 Identifier_Character_Set : Character;
603 -- GNAT
604 -- This variable indicates the character set to be used for identifiers.
605 -- The possible settings are:
f15731c4 606 -- '1' Latin-5 (ISO-8859-1)
607 -- '2' Latin-5 (ISO-8859-2)
608 -- '3' Latin-5 (ISO-8859-3)
609 -- '4' Latin-5 (ISO-8859-4)
610 -- '5' Latin-5 (ISO-8859-5, Cyrillic)
611 -- '9' Latin-5 (ISO-8859-9)
83cce46b 612 -- 'p' PC (US, IBM page 437)
613 -- '8' PC (European, IBM page 850)
614 -- 'f' Full upper set (all distinct)
e2aa7314 615 -- 'n' No upper characters (Ada 83 rules)
83cce46b 616 -- 'w' Latin-1 plus wide characters allowed in identifiers
617 --
618 -- The setting affects the set of letters allowed in identifiers and the
619 -- upper/lower case equivalences. It does not affect the interpretation of
620 -- character and string literals, which are always stored using the actual
621 -- coding in the source program. This variable is initialized to the
622 -- default value appropriate to the system (in Osint.Initialize), and then
623 -- reset if a command line switch is used to change the setting.
624
fbc67f84 625 Ignore_Rep_Clauses : Boolean := False;
626 -- GNAT
627 -- Set True to ignore all representation clauses. Useful when compiling
628 -- code from foreign compilers for checking or ASIS purposes. Can be
629 -- set True by use of -gnatI.
630
631 Implementation_Unit_Warnings : Boolean := True;
632 -- GNAT
633 -- Set True to active warnings for use of implementation internal units.
634 -- Can be controlled by use of -gnatwi/-gnatwI.
635
636 Implicit_Packing : Boolean := False;
637 -- GNAT
638 -- If set True, then a Size attribute clause on an array is allowed to
639 -- cause implicit packing instead of generating an error message. Set by
640 -- use of pragma Implicit_Packing.
641
83cce46b 642 Ineffective_Inline_Warnings : Boolean := False;
643 -- GNAT
644 -- Set True to activate warnings if front-end inlining (-gnatN) is not
645 -- able to actually inline a particular call (or all calls). Can be
646 -- controlled by use of -gnatwp/-gnatwP.
647
648 Init_Or_Norm_Scalars : Boolean := False;
9dfe12ae 649 -- GNAT, GANTBIND
83cce46b 650 -- Set True if a pragma Initialize_Scalars applies to the current unit.
651 -- Also set True if a pragma Normalize_Scalars applies.
652
653 Initialize_Scalars : Boolean := False;
654 -- GNAT
655 -- Set True if a pragma Initialize_Scalars applies to the current unit.
656 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
657
9dfe12ae 658 Initialize_Scalars_Mode1 : Character := 'I';
659 Initialize_Scalars_Mode2 : Character := 'N';
83cce46b 660 -- GNATBIND
9dfe12ae 661 -- Set to two characters from -S switch (IN/LO/HI/EV/xx). The default
662 -- is IN (invalid values), used if no -S switch is used.
83cce46b 663
664 Inline_Active : Boolean := False;
665 -- GNAT
666 -- Set True to activate pragma Inline processing across modules. Default
667 -- for now is not to inline across module boundaries.
668
9dfe12ae 669 Interface_Library_Unit : Boolean := False;
670 -- GNATBIND
671 -- Set to True to indicate that at least one ALI file is an interface ALI:
672 -- then elaboration flag checks are to be generated in the binder
673 -- generated file.
674
9af0ddc7 675 Generate_SCIL : Boolean := False;
96da3284 676 -- GNAT
9af0ddc7 677 -- Set True to activate SCIL code generation.
96da3284 678
3a2db8ab 679 Invalid_Value_Used : Boolean := False;
680 -- GNAT
681 -- Set True if a valid Invalid_Value attribute is encountered
682
9c5da18f 683 Follow_Links_For_Files : Boolean := False;
684 -- PROJECT MANAGER
9f864429 685 -- Set to True (-eL) to process the project files in trusted mode. If
686 -- Follow_Links is False, it is assumed that the project doesn't contain
9c5da18f 687 -- any file duplicated through symbolic links (although the latter are
688 -- still valid if they point to a file which is outside of the project),
689 -- and that no directory has a name which is a valid source name.
690
ec40265d 691 Follow_Links_For_Dirs : Boolean := False;
9c5da18f 692 -- PROJECT MANAGER
9f864429 693 -- Set to True if directories can be links in this project, and therefore
694 -- additional system calls must be performed to ensure that we always see
695 -- the same full name for each directory.
5329ca64 696
83cce46b 697 Front_End_Inlining : Boolean := False;
698 -- GNAT
0bba2a3e 699 -- Set True to activate inlining by front-end expansion
83cce46b 700
701 Inline_Processing_Required : Boolean := False;
702 -- GNAT
9f864429 703 -- Set True if inline processing is required. Inline processing is required
704 -- if an active Inline pragma is processed. The flag is set for a pragma
705 -- Inline or Inline_Always that is actually active.
83cce46b 706
707 In_Place_Mode : Boolean := False;
708 -- GNATMAKE
27f48659 709 -- Set True to store ALI and object files in place i.e. in the object
83cce46b 710 -- directory if these files already exist or in the source directory
711 -- if not.
712
713 Keep_Going : Boolean := False;
9c5da18f 714 -- GNATMAKE, GPRMAKE, GPRBUILD
9f864429 715 -- When True signals to ignore compilation errors and keep processing
716 -- sources until there is no more work.
83cce46b 717
5c99c290 718 Keep_Temporary_Files : Boolean := False;
719 -- GNATCMD
720 -- When True the temporary files created by the GNAT driver are not
721 -- deleted. Set by switch -dn or qualifier /KEEP_TEMPORARY_FILES.
722
cd277670 723 Leap_Seconds_Support : Boolean := False;
724 -- GNATBIND
725 -- Set to True to enable leap seconds support in Ada.Calendar and its
726 -- children.
727
9d40d585 728 Link_Only : Boolean := False;
9c5da18f 729 -- GNATMAKE, GPRMAKE, GPRBUILD
9f864429 730 -- Set to True to skip compile and bind steps (except when Bind_Only is
731 -- set to True).
9d40d585 732
f15731c4 733 List_Restrictions : Boolean := False;
734 -- GNATBIND
735 -- Set to True to list restrictions pragmas that could apply to partition
736
83cce46b 737 List_Units : Boolean := False;
738 -- GNAT
f15731c4 739 -- List units in the active library for a compilation (-gnatu switch)
83cce46b 740
8255b799 741 List_Closure : Boolean := False;
742 -- GNATBIND
743 -- List all sources in the closure of a main (-R gnatbind switch)
744
83cce46b 745 List_Dependencies : Boolean := False;
746 -- GNATMAKE
747 -- When True gnatmake verifies that the objects are up to date and
f15731c4 748 -- outputs the list of object dependencies (-M switch).
749 -- Output depends if -a switch is used or not.
750 -- This list can be used directly in a Makefile.
83cce46b 751
752 List_Representation_Info : Int range 0 .. 3 := 0;
753 -- GNAT
f15731c4 754 -- Set non-zero by -gnatR switch to list representation information.
83cce46b 755 -- The settings are as follows:
756 --
757 -- 0 = no listing of representation information (default as above)
758 -- 1 = list rep info for user defined record and array types
759 -- 2 = list rep info for all user defined types and objects
760 -- 3 = like 2, but variable fields are decoded symbolically
761
f15731c4 762 List_Representation_Info_To_File : Boolean := False;
763 -- GNAT
9f864429 764 -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3 to be
765 -- written to file.rep (where file is the name of the source file) instead
766 -- of stdout. For example, if file x.adb is compiled using -gnatR2s then
767 -- representation info is written to x.adb.ref.
f15731c4 768
9dfe12ae 769 List_Representation_Info_Mechanisms : Boolean := False;
770 -- GNAT
9f864429 771 -- Set true by -gnatRm switch. Causes information on mechanisms to be
772 -- included in the representation output information.
9dfe12ae 773
774 List_Preprocessing_Symbols : Boolean := False;
775 -- GNAT, GNATPREP
776 -- Set to True if symbols for preprocessing a source are to be listed
9f864429 777 -- before preprocessing occurs. Set to True by switch -s of gnatprep or
778 -- -s in preprocessing data file for the compiler.
9dfe12ae 779
8255b799 780 type Create_Repinfo_File_Proc is access procedure (Src : String);
3a838102 781 type Write_Repinfo_Line_Proc is access procedure (Info : String);
782 type Close_Repinfo_File_Proc is access procedure;
f15731c4 783 -- Types used for procedure addresses below
784
3a838102 785 Create_Repinfo_File_Access : Create_Repinfo_File_Proc := null;
786 Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null;
787 Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null;
f15731c4 788 -- GNAT
9f864429 789 -- These three locations are left null when operating in non-compiler (e.g.
790 -- ASIS mode), but when operating in compiler mode, they are set to point
791 -- to the three corresponding procedures in Osint-C. The reason for this
792 -- slightly strange interface is to stop Repinfo from dragging in Osint in
793 -- ASIS mode, which would include lots of unwanted units in the ASIS build.
f15731c4 794
3a838102 795 type Create_List_File_Proc is access procedure (S : String);
796 type Write_List_Info_Proc is access procedure (S : String);
797 type Close_List_File_Proc is access procedure;
798 -- Types used for procedure addresses below
799
800 Create_List_File_Access : Create_List_File_Proc := null;
801 Write_List_Info_Access : Write_List_Info_Proc := null;
802 Close_List_File_Access : Close_List_File_Proc := null;
803 -- GNAT
804 -- These three locations are left null when operating in non-compiler
805 -- (e.g. from the binder), but when operating in compiler mode, they are
806 -- set to point to the three corresponding procedures in Osint-C. The
807 -- reason for this slightly strange interface is to prevent Repinfo
808 -- from dragging in Osint-C in the binder, which would include unwanted
9f864429 809 -- units in the binder.
3a838102 810
83cce46b 811 Locking_Policy : Character := ' ';
9dfe12ae 812 -- GNAT, GNATBIND
9f864429 813 -- Set to ' ' for the default case (no locking policy specified). Reset to
814 -- first character (uppercase) of locking policy name if a valid pragma
815 -- Locking_Policy is encountered.
83cce46b 816
9dfe12ae 817 Locking_Policy_Sloc : Source_Ptr := No_Location;
818 -- GNAT, GNATBIND
9f864429 819 -- Remember location of previous Locking_Policy pragma. This is used for
820 -- inconsistency error messages. A value of System_Location is used if the
821 -- policy is set in package System.
9dfe12ae 822
83cce46b 823 Look_In_Primary_Dir : Boolean := True;
9dfe12ae 824 -- GNAT, GNATBIND, GNATMAKE, GNATCLEAN
9f864429 825 -- Set to False if a -I- was present on the command line. When True we are
826 -- allowed to look in the primary directory to locate other source or
827 -- library files.
83cce46b 828
9dfe12ae 829 Make_Steps : Boolean := False;
830 -- GNATMAKE
831 -- Set to True when either Compile_Only, Bind_Only or Link_Only is
832 -- set to True.
833
1bbc9831 834 Main_Index : Int := 0;
835 -- GNATMAKE
836 -- This is set to non-zero by gnatmake switch -eInnn to indicate that
837 -- the main program is the nnn unit in a multi-unit source file.
838
e4bd5d4a 839 Mapping_File_Name : String_Ptr := null;
840 -- GNAT
841 -- File name of mapping between unit names, file names and path names.
842 -- (given by switch -gnatem)
843
15175b09 844 Maximum_Messages : Int := 9999;
83cce46b 845 -- GNAT, GNATBIND
15175b09 846 -- Maximum default number of errors before compilation is terminated, or in
847 -- the case of GNAT, maximum number of warnings before further warnings are
848 -- suppressed. Can be overridden by -gnatm (GNAT) or -m (GNATBIND) switch.
83cce46b 849
850 Maximum_File_Name_Length : Int;
851 -- GNAT, GNATBIND
852 -- Maximum number of characters allowed in a file name, not counting the
853 -- extension, as set by the appropriate switch. If no switch is given,
854 -- then this value is initialized by Osint to the appropriate value.
855
856 Maximum_Processes : Positive := 1;
9c5da18f 857 -- GNATMAKE, GPRMAKE, GPRBUILD
83cce46b 858 -- Maximum number of processes that should be spawned to carry out
859 -- compilations.
860
861 Minimal_Recompilation : Boolean := False;
862 -- GNATMAKE
0bba2a3e 863 -- Set to True if minimal recompilation mode requested
83cce46b 864
8255b799 865 Special_Exception_Package_Used : Boolean := False;
866 -- GNAT
867 -- Set to True if either of the unit GNAT.Most_Recent_Exception or
868 -- GNAT.Exception_Traces is with'ed. Used to inhibit transformation of
869 -- local raise statements into gotos in the presence of either package.
870
fa7497e8 871 Multiple_Unit_Index : Int;
872 -- GNAT
873 -- This is set non-zero if the current unit is being compiled in multiple
874 -- unit per file mode, meaning that the current unit is selected from the
875 -- sequence of units in the current source file, using the value stored
876 -- in this variable (e.g. 2 = select second unit in file). A value of
877 -- zero indicates that we are in normal (one unit per file) mode.
878
83cce46b 879 No_Main_Subprogram : Boolean := False;
880 -- GNATMAKE, GNATBIND
881 -- Set to True if compilation/binding of a program without main
882 -- subprogram requested.
883
9dfe12ae 884 No_Run_Time_Mode : Boolean := False;
885 -- GNAT, GNATBIND
886 -- This flag is set True if a No_Run_Time pragma is encountered. See
887 -- spec of Rtsfind for a full description of handling of this pragma.
888
c9c1031f 889 No_Split_Units : Boolean := False;
890 -- GPRBUILD
891 -- Set to True with switch --no-split-units. When True, unit sources, spec,
892 -- body and subunits, must all be in the same project.This is checked after
893 -- each compilation.
894
3d875462 895 No_Stdinc : Boolean := False;
896 -- GNAT, GNATBIND, GNATMAKE, GNATFIND, GNATXREF
897 -- Set to True if no default source search dirs added to search list
898
899 No_Stdlib : Boolean := False;
900 -- GNATMAKE, GNATBIND, GNATFIND, GNATXREF
901 -- Set to True if no default library search dirs added to search list
902
903 No_Strict_Aliasing : Boolean := False;
904 -- GNAT
905 -- Set True if pragma No_Strict_Aliasing with no parameters encountered
906
83cce46b 907 Normalize_Scalars : Boolean := False;
9dfe12ae 908 -- GNAT, GNATBIND
83cce46b 909 -- Set True if a pragma Normalize_Scalars applies to the current unit.
910 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
911
9dfe12ae 912 Object_Directory_Present : Boolean := False;
913 -- GNATMAKE
914 -- Set to True when an object directory is specified with option -D
83cce46b 915
96ebbaff 916 One_Compilation_Per_Obj_Dir : Boolean := False;
917 -- GNATMAKE, GPRBUILD
918 -- Set to True with switch --single-compile-per-obj-dir. When True, there
919 -- cannot be simultaneous compilations with the object files in the same
920 -- object directory, if project files are used.
921
83cce46b 922 type Operating_Mode_Type is (Check_Syntax, Check_Semantics, Generate_Code);
923 Operating_Mode : Operating_Mode_Type := Generate_Code;
924 -- GNAT
925 -- Indicates the operating mode of the compiler. The default is generate
926 -- code, which runs the parser, semantics and backend. Switches can be
927 -- used to set syntax checking only mode, or syntax and semantics checking
928 -- only mode. Operating_Mode can also be modified as a result of detecting
9dfe12ae 929 -- errors during the compilation process. In particular if any serious
930 -- error is detected then this flag is reset from Generate_Code to
931 -- Check_Semantics after generating an error message.
932
2253aba6 933 Optimize_Alignment : Character := 'O';
27f48659 934 -- Setting of Optimize_Alignment, set to T/S/O for time/space/off. Can
2253aba6 935 -- be modified by use of pragma Optimize_Alignment.
936
3a2db8ab 937 Optimize_Alignment_Local : Boolean := False;
938 -- Set True if Optimize_Alignment mode is set by a local configuration
939 -- pragma that overrides the gnat.adc (or other configuration file) default
940 -- so that the unit is not dependent on the default setting. Also always
941 -- set True for internal units, since these always have a default setting
942 -- of Optimize_Alignment (Off) that is enforced (essentially equivalent to
943 -- them all having such an explicit pragma in each unit).
944
9dfe12ae 945 Original_Operating_Mode : Operating_Mode_Type := Generate_Code;
946 -- GNAT
9f864429 947 -- Indicates the original operating mode of the compiler as set by compiler
948 -- options. This is identical to Operating_Mode except that this is not
949 -- affected by errors.
9dfe12ae 950
951 Optimization_Level : Int;
952 pragma Import (C, Optimization_Level, "optimize");
3a2db8ab 953 -- Constant reflecting the optimization level (0,1,2,3 for -O0,-O1,-O2,-O3)
45045496 954 -- See jmissing.c and aamissing.c for definitions for dotnet/jgnat and
955 -- GNAAMP back ends.
956
957 Optimize_Size : Int;
958 pragma Import (C, Optimize_Size, "optimize_size");
a37e006f 959 -- Constant reflecting setting of -Os (optimize for size). Set to nonzero
960 -- in -Os mode and set to zero otherwise. See jmissing.c and aamissing.c
961 -- for definitions of "optimize_size" for dotnet/jgnat and GNAAMP backends
83cce46b 962
963 Output_File_Name_Present : Boolean := False;
43052740 964 -- GNATBIND, GNAT, GNATMAKE, GPRMAKE
45045496 965 -- Set to True when the output C file name is given with option -o for
966 -- GNATBIND, when the object file name is given with option -gnatO for GNAT
967 -- or when the executable is given with option -o for GNATMAKE or GPRMAKE.
83cce46b 968
969 Output_Linker_Option_List : Boolean := False;
970 -- GNATBIND
971 -- True if output of list of linker options is requested (-K switch set)
972
a6e14bbe 973 Output_ALI_List : Boolean := False;
974 ALI_List_Filename : String_Ptr;
83cce46b 975 -- GNATBIND
a6e14bbe 976 -- True if output of list of ALIs is requested (-A switch set). List is
977 -- output under the given filename, or standard output if not specified.
978
979 Output_Object_List : Boolean := False;
980 Object_List_Filename : String_Ptr;
981 -- GNATBIND
982 -- True if output of list of objects is requested (-O switch set). List is
983 -- output under the given filename, or standard output if not specified.
83cce46b 984
fbc67f84 985 Overflow_Checks_Unsuppressed : Boolean := False;
986 -- GNAT
9f864429 987 -- Set to True if at least one occurrence of pragma Unsuppress
fbc67f84 988 -- (All_Checks|Overflow_Checks) has been processed.
989
0bba2a3e 990 Persistent_BSS_Mode : Boolean := False;
991 -- GNAT
992 -- True if a Persistent_BSS configuration pragma is in effect, causing
993 -- potentially persistent data to be placed in the persistent_bss section.
994
83cce46b 995 Pessimistic_Elab_Order : Boolean := False;
996 -- GNATBIND
997 -- True if pessimistic elaboration order is to be chosen (-p switch set)
998
999 Polling_Required : Boolean := False;
1000 -- GNAT
1001 -- Set to True if polling for asynchronous abort is enabled by using
1002 -- the -gnatP option for GNAT.
1003
9dfe12ae 1004 Preprocessing_Data_File : String_Ptr := null;
1005 -- GNAT
27f48659 1006 -- Set by switch -gnatep=. The file name of the preprocessing data file.
9dfe12ae 1007
83cce46b 1008 Print_Generated_Code : Boolean := False;
1009 -- GNAT
1010 -- Set to True to enable output of generated code in source form. This
1011 -- flag is set by the -gnatG switch.
1012
e7b2d6bc 1013 Print_Standard : Boolean := False;
1014 -- GNAT
1015 -- Set to true to enable printing of package standard in source form.
1016 -- This flag is set by the -gnatS switch
1017
83cce46b 1018 Propagate_Exceptions : Boolean := False;
1019 -- GNAT
1020 -- Indicates if subprogram descriptor exception tables should be
1021 -- built for imported subprograms. Set True if a Propagate_Exceptions
1022 -- pragma applies to the extended main unit.
1023
9dfe12ae 1024 type Usage is (Unknown, Not_In_Use, In_Use);
1025 Project_File_In_Use : Usage := Unknown;
83cce46b 1026 -- GNAT
9f864429 1027 -- Indicates if a project file is used or not. Set to In_Use by the first
1028 -- SFNP pragma.
9dfe12ae 1029
1030 Queuing_Policy : Character := ' ';
1031 -- GNAT, GNATBIND
9f864429 1032 -- Set to ' ' for the default case (no queuing policy specified). Reset to
1033 -- first character (uppercase) of locking policy name if a valid
83cce46b 1034 -- Queuing_Policy pragma is encountered.
1035
9dfe12ae 1036 Queuing_Policy_Sloc : Source_Ptr := No_Location;
1037 -- GNAT, GNATBIND
9f864429 1038 -- Remember location of previous Queuing_Policy pragma. This is used for
1039 -- inconsistency error messages. A value of System_Location is used if the
1040 -- policy is set in package System.
9dfe12ae 1041
83cce46b 1042 Quiet_Output : Boolean := False;
9c5da18f 1043 -- GNATMAKE, GNATCLEAN, GPRMAKE, GPRBUILD, GPRCLEAN
9dfe12ae 1044 -- Set to True if the tool should not have any output if there are no
1045 -- errors or warnings.
1046
43052740 1047 Replace_In_Comments : Boolean := False;
1048 -- GNATPREP
1049 -- Set to True if -C switch used
1050
9dfe12ae 1051 RTS_Lib_Path_Name : String_Ptr := null;
1052 RTS_Src_Path_Name : String_Ptr := null;
1053 -- GNAT
1054 -- Set to the "adalib" and "adainclude" directories of the run time
1055 -- specified by --RTS=.
83cce46b 1056
f15731c4 1057 RTS_Switch : Boolean := False;
1058 -- GNAT, GNATMAKE, GNATBIND, GNATLS, GNATFIND, GNATXREF
1059 -- Set to True when the --RTS switch is set
1060
9dfe12ae 1061 Run_Path_Option : Boolean := True;
1062 -- GNATMAKE, GNATLINK
1063 -- Set to False when no run_path_option should be issued to the linker
1064
2e12de5f 1065 Search_Directory_Present : Boolean := False;
1066 -- GNAT
9f864429 1067 -- Set to True when argument is -I. Reset to False when next argument, a
1068 -- search directory path is taken into account. Note that this is quite
1069 -- different from other switches in this section in that it is only set in
1070 -- a transitory manner as a result of scanning a -I switch with no file
1071 -- name, and if set, is an indication that the next argument is to be
1072 -- treated as a file name.
2e12de5f 1073
5c61a0ff 1074 Sec_Stack_Used : Boolean := False;
1075 -- GNAT, GBATBIND
9f864429 1076 -- Set True if generated code uses the System.Secondary_Stack package. For
1077 -- the binder, set if any unit uses the secondary stack package.
5c61a0ff 1078
a39f1c9d 1079 Setup_Projects : Boolean := False;
1080 -- GNAT DRIVER
1081 -- Set to True for GNAT SETUP: the Project Manager creates non existing
1082 -- object, library and exec directories.
1083
83cce46b 1084 Shared_Libgnat : Boolean;
1085 -- GNATBIND
9f864429 1086 -- Set to True if a shared libgnat is requested by using the -shared option
1087 -- for GNATBIND and to False when using the -static option. The value of
1088 -- this flag is set by Gnatbind.Scan_Bind_Arg.
83cce46b 1089
b2603bc0 1090 Short_Circuit_And_Or : Boolean := False;
1091 -- GNAT
1092 -- Set True if a pragma Short_Circuit_And_Or applies to the current unit.
1093
da8b631d 1094 Short_Descriptors : Boolean := False;
1095 -- GNAT
1096 -- Set True if a pragma Short_Descriptors applies to the current unit.
1097
4076879f 1098 Sprint_Line_Limit : Nat := 72;
da8b631d 1099 -- GNAT
4076879f 1100 -- Limit values for chopping long lines in Sprint output, can be reset
1101 -- by use of NNN parameter with -gnatG or -gnatD switches.
1102
83cce46b 1103 Stack_Checking_Enabled : Boolean;
1104 -- GNAT
0bba2a3e 1105 -- Set to indicate if -fstack-check switch is set for the compilation. True
1106 -- means that the switch is set, so that stack checking is enabled. False
1107 -- means that the switch is not set (no stack checking). This value is
1108 -- obtained from the external imported value flag_stack_check in the gcc
1109 -- backend (see Frontend) and may be referenced throughout the compilation
1110 -- phases.
83cce46b 1111
83cce46b 1112 Style_Check : Boolean := False;
1113 -- GNAT
9f864429 1114 -- Set True to perform style checks. Activates checks carried out in
1115 -- package Style (see body of this package for details of checks) This
1116 -- flag is set True by either the -gnatg or -gnaty switches.
83cce46b 1117
9c5da18f 1118 Suppress_All_Inlining : Boolean := False;
1119 -- GNAT
1120 -- Set by -fno-inline. Suppresses all inlining, both front end and back end
1121 -- regardless of any other switches that are set.
1122
12e8797f 1123 Suppress_Control_Flow_Optimizations : Boolean := False;
1124 -- GNAT
1125 -- Set by -fpreserve-control-flow. Suppresses control flow optimizations
1126 -- that interfere with coverage analysis based on the object code.
1127
83cce46b 1128 System_Extend_Pragma_Arg : Node_Id := Empty;
1129 -- GNAT
1130 -- Set non-empty if and only if a correct Extend_System pragma was present
1131 -- in which case it points to the argument of the pragma, and the name can
1132 -- be located as Chars (Expression (System_Extend_Pragma_Arg)).
1133
9dfe12ae 1134 System_Extend_Unit : Node_Id := Empty;
1135 -- GNAT
1136 -- This is set to Empty if GNAT_Mode is set, since pragma Extend_System
1137 -- is never appropriate in GNAT_Mode (and causes troubles, including
1138 -- bogus circularities, if we try to compile the run-time library with
1139 -- a System extension). If GNAT_Mode is not set, then System_Extend_Unit
0bba2a3e 1140 -- is a copy of the value set in System_Extend_Pragma_Arg.
9dfe12ae 1141
83cce46b 1142 Subunits_Missing : Boolean := False;
f15731c4 1143 -- GNAT
83cce46b 1144 -- This flag is set true if missing subunits are detected with code
1145 -- generation active. This causes code generation to be skipped.
1146
f15731c4 1147 Suppress_Checks : Boolean := False;
1148 -- GNAT
1149 -- Set to True if -gnatp (suppress all checks) switch present.
1150
9dfe12ae 1151 Suppress_Options : Suppress_Array;
83cce46b 1152 -- GNAT
1153 -- Flags set True to suppress corresponding check, i.e. add an implicit
1154 -- pragma Suppress at the outer level of each unit compiled. Note that
1155 -- these suppress actions can be overridden by the use of the Unsuppress
1156 -- pragma. This variable is initialized by Osint.Initialize.
1157
9dfe12ae 1158 Suppress_Back_Annotation : Boolean := False;
1159 -- GNAT
1160 -- This flag is set True if back annotation of representation information
1161 -- is to be suppressed. This is set if neither -gnatt or -gnatR0-3 is set.
1162 -- This avoids unnecessary time being spent on back annotation.
1163
83cce46b 1164 Table_Factor : Int := 1;
f15731c4 1165 -- GNAT
83cce46b 1166 -- Factor by which all initial table sizes set in Alloc are multiplied.
0bba2a3e 1167 -- Used in Table to calculate initial table sizes (the initial table size
1168 -- is the value in Alloc, used as the Table_Initial parameter value,
1169 -- multiplied by the factor given here. The default value is used if no
1170 -- -gnatT switch appears.
83cce46b 1171
662256db 1172 Tagged_Type_Expansion : Boolean := True;
1173 -- GNAT
1174 -- Set True if tagged types and interfaces should be expanded by the
9f864429 1175 -- front-end. If False, the original tree is left unexpanded for tagged
1176 -- types and dispatching calls, assuming the underlying target supports
1177 -- it (e.g. in the JVM case).
662256db 1178
83cce46b 1179 Task_Dispatching_Policy : Character := ' ';
9dfe12ae 1180 -- GNAT, GNATBIND
83cce46b 1181 -- Set to ' ' for the default case (no task dispatching policy specified).
1182 -- Reset to first character (uppercase) of task dispatching policy name
1183 -- if a valid Task_Dispatching_Policy pragma is encountered.
1184
9dfe12ae 1185 Task_Dispatching_Policy_Sloc : Source_Ptr := No_Location;
1186 -- GNAT, GNATBIND
1187 -- Remember location of previous Task_Dispatching_Policy pragma. This is
1188 -- used for inconsistency error messages. A value of System_Location is
1189 -- used if the policy is set in package System.
1190
83cce46b 1191 Tasking_Used : Boolean := False;
1192 -- Set True if any tasking construct is encountered. Used to activate the
f15731c4 1193 -- output of the Q, L and T lines in ALI files.
83cce46b 1194
1195 Time_Slice_Set : Boolean := False;
f15731c4 1196 -- GNATBIND
83cce46b 1197 -- Set True if a pragma Time_Slice is processed in the main unit, or
f15731c4 1198 -- if the -gnatTnn switch is present to set a time slice value.
83cce46b 1199
1200 Time_Slice_Value : Nat;
f15731c4 1201 -- GNATBIND
0bba2a3e 1202 -- Time slice value. Valid only if Time_Slice_Set is True, i.e. if
1203 -- Time_Slice pragma has been processed. Set to the time slice value in
1204 -- microseconds. Negative values are stored as zero, and the value is not
1205 -- larger than 1_000_000_000 (1000 seconds). Values larger than this are
1206 -- reset to this maximum. This can also be set with the -gnatTnn switch.
83cce46b 1207
1208 Tolerate_Consistency_Errors : Boolean := False;
1209 -- GNATBIND
0bba2a3e 1210 -- Tolerate time stamp and other consistency errors. If this flag is set to
1211 -- True (-t), then inconsistencies result in warnings rather than errors.
83cce46b 1212
75bd324d 1213 Treat_Restrictions_As_Warnings : Boolean := False;
1214 -- GNAT
1215 -- Set True to treat pragma Restrictions as Restriction_Warnings. Set by
1216 -- -gnatr switch.
1217
83cce46b 1218 Tree_Output : Boolean := False;
1219 -- GNAT
f15731c4 1220 -- Set to True (-gnatt) to generate output tree file
83cce46b 1221
9c5da18f 1222 True_VMS_Target : Boolean := False;
1223 -- Set True if we are on a VMS target. The setting of this flag reflects
1224 -- the true state of the compile, unlike Targparm.OpenVMS_On_Target which
1225 -- can also be true when debug flag m is set (-gnatdm). This is used in the
1226 -- few cases where we do NOT want -gnatdm to trigger the VMS behavior.
1227
83cce46b 1228 Try_Semantics : Boolean := False;
1229 -- GNAT
1230 -- Flag set to force attempt at semantic analysis, even if parser errors
1231 -- occur. This will probably cause blowups at this stage in the game. On
1232 -- the other hand, most such blowups will be caught cleanly and simply
f15731c4 1233 -- say compilation abandoned. This flag is set to True by -gnatq or -gnatQ.
83cce46b 1234
f812e64f 1235 Unchecked_Shared_Lib_Imports : Boolean := False;
1236 -- GPRBUILD
1237 -- Set to True when shared library projects are allowed to import projects
1238 -- that are not shared library projects. Set by switch
1239 -- --unchecked-shared-lib-imports.
1240
9dfe12ae 1241 Undefined_Symbols_Are_False : Boolean := False;
1242 -- GNAT, GNATPREP
1243 -- Set to True by switch -u of gnatprep or -u in the preprocessing data
1244 -- file for the compiler. Indicates that while preprocessing sources,
1245 -- symbols that are not defined have the value FALSE.
1246
83cce46b 1247 Unique_Error_Tag : Boolean := Tag_Errors;
1248 -- GNAT
1249 -- Indicates if error messages are to be prefixed by the string error:
1250 -- Initialized from Tag_Errors, can be forced on with the -gnatU switch.
1251
9dfe12ae 1252 Universal_Addressing_On_AAMP : Boolean := False;
1253 -- GNAAMP
0bba2a3e 1254 -- Indicates if library-level objects should be accessed and updated using
1255 -- universal addressing instructions on the AAMP architecture. This flag is
1256 -- set to True when pragma Universal_Data is given as a configuration
1257 -- pragma.
9dfe12ae 1258
83cce46b 1259 Unreserve_All_Interrupts : Boolean := False;
1260 -- GNAT, GNATBIND
0bba2a3e 1261 -- Normally set False, set True if a valid Unreserve_All_Interrupts pragma
1262 -- appears anywhere in the main unit for GNAT, or if any ALI file has the
1263 -- corresponding attribute set in GNATBIND.
83cce46b 1264
1265 Upper_Half_Encoding : Boolean := False;
9c5da18f 1266 -- GNAT, GNATBIND
3a2db8ab 1267 -- Normally set False, indicating that upper half ISO 8859-1 characters are
83cce46b 1268 -- used in the normal way to represent themselves. If the wide character
0bba2a3e 1269 -- encoding method uses the upper bit for this encoding, then this flag is
1270 -- set True, and upper half characters in the source indicate the start of
9c5da18f 1271 -- a wide character sequence. Set by -gnatW or -W switches.
83cce46b 1272
6cd460aa 1273 Use_Include_Path_File : Boolean := False;
1274 -- GNATMAKE, GPRBUILD
1275 -- When True, create a source search path file, even when a mapping file
1276 -- is used.
1277
83cce46b 1278 Usage_Requested : Boolean := False;
1279 -- GNAT, GNATBIND, GNATMAKE
f15731c4 1280 -- Set to True if -h (-gnath for the compiler) switch encountered
1281 -- requesting usage information
83cce46b 1282
c9e3ee19 1283 Use_Expression_With_Actions : Boolean;
06e076c6 1284 -- The N_Expression_With_Actions node has been introduced relatively
1285 -- recently, and not all back ends are prepared to handle it yet. So
1286 -- we use this flag to suppress its use during a transitional period.
c9e3ee19 1287 -- Currently the default is False for all cases (set in gnat1drv).
1288 -- The default can be modified using -gnatd.X/-gnatd.Y.
06e076c6 1289
e4089178 1290 Use_Pragma_Linker_Constructor : Boolean := False;
1291 -- GNATBIND
1292 -- True if pragma Linker_Constructor applies to adainit
1293
83cce46b 1294 Use_VADS_Size : Boolean := False;
1295 -- GNAT
1296 -- Set to True if a valid pragma Use_VADS_Size is processed
1297
1298 Validity_Checks_On : Boolean := True;
f15731c4 1299 -- GNAT
83cce46b 1300 -- This flag determines if validity checking is on or off. The initial
1301 -- state is on, and the required default validity checks are active. The
0bba2a3e 1302 -- actual set of checks that is performed if Validity_Checks_On is set is
43052740 1303 -- defined by the switches in package Validsw. The Validity_Checks_On flag
0bba2a3e 1304 -- is controlled by pragma Validity_Checks (On | Off), and also some
1305 -- generated compiler code (typically code that has to do with validity
1306 -- check generation) is compiled with this flag set to False. This flag is
1307 -- set to False by the -gnatp switch.
83cce46b 1308
1309 Verbose_Mode : Boolean := False;
43052740 1310 -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN,
9c5da18f 1311 -- GPRMAKE, GPRBUILD, GPRCLEAN
83cce46b 1312 -- Set to True to get verbose mode (full error message text and location
1313 -- information sent to standard output, also header, copyright and summary)
1314
43052740 1315 type Verbosity_Level_Type is (None, Low, Medium, High);
483fc6a6 1316 pragma Ordered (Verbosity_Level_Type);
43052740 1317 Verbosity_Level : Verbosity_Level_Type := High;
1318 -- GNATMAKE, GPRMAKE
1319 -- Modified by gnatmake or gprmake switches -v, -vl, -vm, -vh. Indicates
1320 -- the level of verbosity of informational messages:
1321 --
1322 -- In Low Verbosity, the reasons why a source is recompiled, the name
1323 -- of the executable and the reason it must be rebuilt is output.
1324 --
1325 -- In Medium Verbosity, additional lines are output for each ALI file
1326 -- that is checked.
1327 --
1328 -- In High Verbosity, additional lines are output when the ALI file
1329 -- is part of an Ada library, is read-only or is part of the runtime.
1330
0bba2a3e 1331 Warn_On_Ada_2005_Compatibility : Boolean := True;
1332 -- GNAT
3a838102 1333 -- Set to True to generate all warnings on Ada 2005 compatibility issues,
0bba2a3e 1334 -- including warnings on Ada 2005 obsolescent features used in Ada 2005
1335 -- mode. Set False by -gnatwY.
1336
1052d172 1337 Warn_On_Ada_2012_Compatibility : Boolean := True;
1338 -- GNAT
1339 -- Set to True to generate all warnings on Ada 2012 compatibility issues,
1340 -- including warnings on Ada 2012 obsolescent features used in Ada 2012
1341 -- mode. Set False by -gnatwY.
1342
3a2db8ab 1343 Warn_On_Parameter_Order : Boolean := False;
1344 -- GNAT
1345 -- Set to True to generate warnings for cases where the argument list for
1346 -- a call is a sequence of identifiers that match the formal identifiers,
1347 -- but are in the wrong order.
1348
9c5da18f 1349 Warn_On_Assertion_Failure : Boolean := True;
1350 -- GNAT
1351 -- Set to True to activate warnings on assertions that can be determined
1352 -- at compile time will always fail. Set false by -gnatw.A.
1353
3a838102 1354 Warn_On_Assumed_Low_Bound : Boolean := True;
1355 -- GNAT
1356 -- Set to True to activate warnings for string parameters that are indexed
1357 -- with literals or S'Length, presumably assuming a lower bound of one. Set
1358 -- False by -gnatwW.
1359
cb5e147f 1360 Warn_On_Bad_Fixed_Value : Boolean := False;
1361 -- GNAT
1362 -- Set to True to generate warnings for static fixed-point expression
1363 -- values that are not an exact multiple of the small value of the type.
1364
cc46ff4b 1365 Warn_On_Biased_Representation : Boolean := True;
1366 -- GNAT
1367 -- Set to True to generate warnings for size clauses, component clauses
1368 -- and component_size clauses that force biased representation. Set False
1369 -- by -gnatw.B.
1370
9dfe12ae 1371 Warn_On_Constant : Boolean := False;
83cce46b 1372 -- GNAT
9dfe12ae 1373 -- Set to True to generate warnings for variables that could be declared
1374 -- as constants. Modified by use of -gnatwk/K.
83cce46b 1375
3a838102 1376 Warn_On_Deleted_Code : Boolean := False;
1377 -- GNAT
1378 -- Set to True to generate warnings for code deleted by the front end
1379 -- for conditional statements whose outcome is known at compile time.
1380 -- Modified by use of -gnatwt/T.
1381
f15731c4 1382 Warn_On_Dereference : Boolean := False;
1383 -- GNAT
1384 -- Set to True to generate warnings for implicit dereferences for array
1385 -- indexing and record component access. Modified by use of -gnatwd/D.
1386
9dfe12ae 1387 Warn_On_Export_Import : Boolean := True;
1388 -- GNAT
1389 -- Set to True to generate warnings for suspicious use of export or
1390 -- import pragmas. Modified by use of -gnatwx/X.
1391
83cce46b 1392 Warn_On_Hiding : Boolean := False;
1393 -- GNAT
1394 -- Set to True to generate warnings if a declared entity hides another
1395 -- entity. The default is that this warning is suppressed.
1396
9dfe12ae 1397 Warn_On_Modified_Unread : Boolean := False;
1398 -- GNAT
0bba2a3e 1399 -- Set to True to generate warnings if a variable is assigned but is never
9c5da18f 1400 -- read. Also controls warnings for similar cases involving out parameters,
1401 -- but only if there is only one out parameter for the procedure involved.
1402 -- The default is that this warning is suppressed.
96da3284 1403
9c5da18f 1404 Warn_On_All_Unread_Out_Parameters : Boolean := False;
96da3284 1405 -- GNAT
9c5da18f 1406 -- Set to True to generate warnings in all cases where a variable is
1407 -- modified by being passed as to an OUT formal, but the resulting value is
1408 -- never read. The default is that this warning is suppressed, except in
1409 -- the case of
9dfe12ae 1410
1411 Warn_On_No_Value_Assigned : Boolean := True;
1412 -- GNAT
1413 -- Set to True to generate warnings if no value is ever assigned to a
1414 -- variable that is at least partially uninitialized. Set to false to
1415 -- suppress such warnings. The default is that such warnings are enabled.
1416
fbc67f84 1417 Warn_On_Non_Local_Exception : Boolean := False;
59ac57b5 1418 -- GNAT
1419 -- Set to True to generate warnings for non-local exception raises and also
1420 -- handlers that can never handle a local raise. This warning is only ever
1421 -- generated if pragma Restrictions (No_Exception_Propagation) is set. The
30e5c8d3 1422 -- default is not to generate the warnings except that if the source has
49260fa5 1423 -- at least one exception handler, and this restriction is set, and the
1424 -- warning was not explicitly turned off, then it is turned on by default.
30e5c8d3 1425
1426 No_Warn_On_Non_Local_Exception : Boolean := False;
1427 -- GNAT
1428 -- This is set to True if the above warning is explicitly suppressed. We
1429 -- use this to avoid turning it on by default when No_Exception_Propagation
49260fa5 1430 -- restriction is set and an exception handler is present.
59ac57b5 1431
9dfe12ae 1432 Warn_On_Obsolescent_Feature : Boolean := False;
1433 -- GNAT
0bba2a3e 1434 -- Set to True to generate warnings on use of any feature in Annex or if a
1435 -- subprogram is called for which a pragma Obsolescent applies.
9dfe12ae 1436
aaf44d5a 1437 Warn_On_Overlap : Boolean := False;
1438 -- GNAT
1439 -- Set to True to generate warnings when a writable actual which is not
1440 -- a by-copy type overlaps with another actual in a subprogram call.
1441
59ac57b5 1442 Warn_On_Questionable_Missing_Parens : Boolean := True;
3a838102 1443 -- GNAT
27f48659 1444 -- Set to True to generate warnings for cases where parentheses are missing
3a838102 1445 -- and the usage is questionable, because the intent is unclear.
1446
83cce46b 1447 Warn_On_Redundant_Constructs : Boolean := False;
1448 -- GNAT
1449 -- Set to True to generate warnings for redundant constructs (e.g. useless
1450 -- assignments/conversions). The default is that this warning is disabled.
1451
8255b799 1452 Warn_On_Object_Renames_Function : Boolean := False;
1453 -- GNAT
1454 -- Set to True to generate warnings when a function result is renamed as
1455 -- an object. The default is that this warning is disabled.
1456
59ac57b5 1457 Warn_On_Reverse_Bit_Order : Boolean := True;
1458 -- GNAT
1459 -- Set to True to generate warning (informational) messages for component
1460 -- clauses that are affected by non-standard bit-order. The default is
1461 -- that this warning is enabled.
1462
91a6416d 1463 Warn_On_Suspicious_Modulus_Value : Boolean := True;
1464 -- GNAT
1465 -- Set to True to generate warnings for suspicious modulus values. The
1466 -- default is that this warning is enabled.
1467
9dfe12ae 1468 Warn_On_Unchecked_Conversion : Boolean := True;
1469 -- GNAT
1470 -- Set to True to generate warnings for unchecked conversions that may have
1471 -- non-portable semantics (e.g. because sizes of types differ). The default
1472 -- is that this warning is enabled.
1473
a22215d6 1474 Warn_On_Unordered_Enumeration_Type : Boolean := False;
1475 -- GNAT
1476 -- Set to True to generate warnings for inappropriate uses (comparisons
1477 -- and explicit ranges) on unordered enumeration types (which includes
1478 -- all enumeration types for which pragma Ordered is not given). The
1479 -- default is that this warning is disabled.
1480
9dfe12ae 1481 Warn_On_Unrecognized_Pragma : Boolean := True;
1482 -- GNAT
1483 -- Set to True to generate warnings for unrecognized pragmas. The default
1484 -- is that this warning is enabled.
1485
8255b799 1486 Warn_On_Unrepped_Components : Boolean := False;
1487 -- GNAT
1488 -- Set to True to generate warnings for the case of components of record
1489 -- which have a record representation clause but this component does not
1490 -- have a component clause. The default is that this warning is disabled.
1491
2253aba6 1492 Warn_On_Warnings_Off : Boolean := False;
1493 -- GNAT
1494 -- Set to True to generate warnings for use of Pragma Warnings (Off, ent),
1495 -- where either the pragma is never used, or it could be replaced by a
1496 -- pragma Unmodified or Unreferenced.
1497
83cce46b 1498 type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
1499 Warning_Mode : Warning_Mode_Type := Normal;
1500 -- GNAT, GNATBIND
1501 -- Controls treatment of warning messages. If set to Suppress, warning
1502 -- messages are not generated at all. In Normal mode, they are generated
1503 -- but do not count as errors. In Treat_As_Error mode, warning messages
1504 -- are generated and are treated as errors.
1505
1506 Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets;
9c5da18f 1507 -- GNAT, GNATBIND
83cce46b 1508 -- Method used for encoding wide characters in the source program. See
1509 -- description of type in unit System.WCh_Con for a list of the methods
1510 -- that are currently supported. Note that brackets notation is always
1511 -- recognized in source programs regardless of the setting of this
0bba2a3e 1512 -- variable. The default setting causes only the brackets notation to be
1513 -- recognized. If this is the main unit, this setting also controls the
1514 -- output of the W=? parameter in the ALI file, which is used to provide
9c5da18f 1515 -- the default for encoding [Wide_[Wide_]]Text_IO files. For the binder,
1516 -- the value set here overrides this main unit default.
1517
1518 Wide_Character_Encoding_Method_Specified : Boolean := False;
1519 -- GNAT, GNATBIND
1520 -- Set True if the value in Wide_Character_Encoding_Method was set as
1521 -- a result of an explicit -gnatW? or -W? switch. False otherwise.
83cce46b 1522
1523 Xref_Active : Boolean := True;
1524 -- GNAT
f15731c4 1525 -- Set if cross-referencing is enabled (i.e. xref info in ALI files)
83cce46b 1526
8255b799 1527 Zero_Formatting : Boolean := False;
1528 -- GNATBIND
1529 -- Do no formatting (no title, no leading spaces, no empty lines) in
1530 -- auxiliary outputs (-e, -K, -l, -R).
1531
83cce46b 1532 ----------------------------
1533 -- Configuration Settings --
1534 ----------------------------
1535
0bba2a3e 1536 -- These are settings that are used to establish the mode at the start of
1537 -- each unit. The values defined below can be affected either by command
2253aba6 1538 -- line switches, or by the use of appropriate configuration pragmas in a
1539 -- configuration pragma file.
83cce46b 1540
e2aa7314 1541 Ada_Version_Config : Ada_Version_Type;
83cce46b 1542 -- GNAT
e2aa7314 1543 -- This is the value of the configuration switch for the Ada 83 mode, as
0bba2a3e 1544 -- set by the command line switches -gnat83/95/05, and possibly modified by
1545 -- the use of configuration pragmas Ada_83/Ada95/Ada05. This switch is used
1546 -- to set the initial value for Ada_Version mode at the start of analysis
1547 -- of a unit. Note however, that the setting of this flag is ignored for
1548 -- internal and predefined units (which are always compiled in the most up
1549 -- to date version of Ada).
1550
1551 Ada_Version_Explicit_Config : Ada_Version_Type;
1552 -- GNAT
2e12de5f 1553 -- This is set in the same manner as Ada_Version_Config. The difference is
1554 -- that the setting of this flag is not ignored for internal and predefined
1555 -- units, which for some purposes do indeed access this value, regardless
27f48659 1556 -- of the fact that they are compiled the most up to date ada version).
0bba2a3e 1557
1558 Assertions_Enabled_Config : Boolean;
1559 -- GNAT
1560 -- This is the value of the configuration switch for assertions enabled
1561 -- mode, as possibly set by the command line switch -gnata, and possibly
1562 -- modified by the use of the configuration pragma Assertion_Policy.
83cce46b 1563
c9e9428a 1564 Assume_No_Invalid_Values_Config : Boolean;
1565 -- GNAT
ecf90fb4 1566 -- This is the value of the configuration switch for assuming "no invalid
1567 -- values enabled" mode, as possibly set by the command line switch
c9e9428a 1568 -- -gnatB, and possibly modified by the use of the configuration pragma
1569 -- Assume_No_Invalid_Values.
1570
3a2db8ab 1571 Check_Policy_List_Config : Node_Id;
1572 -- GNAT
1573 -- This points to the list of N_Pragma nodes for Check_Policy pragmas
1574 -- that are linked through the Next_Pragma fields, with the list being
1575 -- terminated by Empty. The order is most recently processed first. This
1576 -- list includes only those pragmas in configuration pragma files.
1577
5c6363c7 1578 Debug_Pragmas_Enabled_Config : Boolean;
1579 -- GNAT
1580 -- This is the value of the configuration switch for debug pragmas enabled
1581 -- mode, as possibly set by the command line switch -gnata and possibly
1582 -- modified by the use of the configuration pragma Debug_Policy.
1583
83cce46b 1584 Dynamic_Elaboration_Checks_Config : Boolean := False;
1585 -- GNAT
1586 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
1587 -- switch or by the use of pragma Elaboration_Checking (Dynamic).
1588
9dfe12ae 1589 Exception_Locations_Suppressed_Config : Boolean := False;
1590 -- GNAT
1591 -- Set True by use of the configuration pragma Suppress_Exception_Messages
1592
83cce46b 1593 Extensions_Allowed_Config : Boolean;
1594 -- GNAT
0bba2a3e 1595 -- This is the flag that indicates whether extensions are allowed. It can
1596 -- be set True either by use of the -gnatX switch, or by use of the
1597 -- configuration pragma Extensions_Allowed (On). It is always set to True
1598 -- for internal GNAT units, since extensions are always permitted in such
1599 -- units.
83cce46b 1600
1601 External_Name_Exp_Casing_Config : External_Casing_Type;
1602 -- GNAT
0bba2a3e 1603 -- This is the value of the configuration switch that controls casing of
1604 -- external symbols for which an explicit external name is given. It can be
1605 -- set to Uppercase by the command line switch -gnatF, and further modified
1606 -- by the use of the configuration pragma External_Name_Casing in the
1607 -- gnat.adc file. This flag is used to set the initial value for
1608 -- External_Name_Exp_Casing at the start of analyzing each unit. Note
1609 -- however that the setting of this flag is ignored for internal and
1610 -- predefined units (which are always compiled with As_Is mode).
83cce46b 1611
1612 External_Name_Imp_Casing_Config : External_Casing_Type;
1613 -- GNAT
0bba2a3e 1614 -- This is the value of the configuration switch that controls casing of
1615 -- external symbols where the external name is implicitly given. It can be
1616 -- set to Uppercase by the command line switch -gnatF, and further modified
1617 -- by the use of the configuration pragma External_Name_Casing in the
1618 -- gnat.adc file. This flag is used to set the initial value for
1619 -- External_Name_Imp_Casing at the start of analyzing each unit. Note
1620 -- however that the setting of this flag is ignored for internal and
1621 -- predefined units (which are always compiled with Lowercase mode).
1622
9c5da18f 1623 Fast_Math_Config : Boolean;
1624 -- GNAT
1625 -- This is the value of the configuration switch that controls Fast_Math
1626 -- mode, as set by a Fast_Math pragma in configuration pragmas. It is
1627 -- used to set the initial value of Fast_Math at the start of each new
1628 -- compilation unit.
1629
3feedf2a 1630 Init_Or_Norm_Scalars_Config : Boolean;
1631 -- GNAT
1632 -- This is the value of the configuration switch that is set by one
1633 -- of the pragmas Initialize_Scalars or Normalize_Scalars.
1634
1635 Initialize_Scalars_Config : Boolean;
1636 -- GNAT
1637 -- This is the value of the configuration switch that is set by the
1638 -- pragma Initialize_Scalars when it appears in the gnat.adc file.
1639 -- This switch is not set when the pragma appears ahead of a given
1640 -- unit, so it does not affect the compilation of other units.
1641
2253aba6 1642 Optimize_Alignment_Config : Character;
1643 -- GNAT
1644 -- This is the value of the configuration switch that controls the
1645 -- alignment optimization mode, as set by an Optimize_Alignment pragma.
1646 -- It is used to set the initial value of Optimize_Alignment at the start
1647 -- of each new compilation unit, except that it is always set to 'O' (off)
1648 -- for internal units.
1649
0bba2a3e 1650 Persistent_BSS_Mode_Config : Boolean;
1651 -- GNAT
1652 -- This is the value of the configuration switch that controls whether
1653 -- potentially persistent data is to be placed in the persistent_bss
1654 -- section. It can be set True by use of the pragma Persistent_BSS.
1655 -- This flag is used to set the initial value of Persistent_BSS_Mode
1656 -- at the start of each compilation unit, except that it is always
1657 -- set False for predefined units.
83cce46b 1658
1659 Polling_Required_Config : Boolean;
1660 -- GNAT
1661 -- This is the value of the configuration switch that controls polling
1662 -- mode. It can be set True by the command line switch -gnatP, and then
0bba2a3e 1663 -- further modified by the use of pragma Polling in the gnat.adc file. This
1664 -- flag is used to set the initial value for Polling_Required at the start
1665 -- of analyzing each unit.
83cce46b 1666
da8b631d 1667 Short_Descriptors_Config : Boolean;
1668 -- GNAT
1669 -- This is the value of the configuration switch that controls the use of
1670 -- Short_Descriptors for setting descriptor default sizes. It can be set
1671 -- True by the use of the pragma Short_Descriptors in the gnat.adc file.
1672 -- This flag is used to set the initial value for Short_Descriptors at the
1673 -- start of analyzing each unit.
1674
83cce46b 1675 Use_VADS_Size_Config : Boolean;
1676 -- GNAT
0bba2a3e 1677 -- This is the value of the configuration switch that controls the use of
27f48659 1678 -- VADS_Size instead of Size wherever the attribute Size is used. It can
0bba2a3e 1679 -- be set True by the use of the pragma Use_VADS_Size in the gnat.adc file.
1680 -- This flag is used to set the initial value for Use_VADS_Size at the
1681 -- start of analyzing each unit. Note however that the setting of this flag
1682 -- is ignored for internal and predefined units (which are always compiled
1683 -- with the standard Size semantics).
83cce46b 1684
1685 type Config_Switches_Type is private;
1686 -- Type used to save values of the switches set from Config values
1687
1688 procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type);
1689 -- This procedure saves the current values of the switches which are
0bba2a3e 1690 -- initialized from the above Config values, and then resets these switches
1691 -- according to the Config value settings.
83cce46b 1692
5c6363c7 1693 procedure Set_Opt_Config_Switches
1694 (Internal_Unit : Boolean;
1695 Main_Unit : Boolean);
0bba2a3e 1696 -- This procedure sets the switches to the appropriate initial values. The
1697 -- parameter Internal_Unit is True for an internal or predefined unit, and
5c6363c7 1698 -- affects the way the switches are set (see above). Main_Unit is true if
1699 -- switches are being set for the main unit (this affects setting of the
fbc67f84 1700 -- assert/debug pragma switches, which are normally set false by default
1701 -- for an internal unit, except when the internal unit is the main unit,
1702 -- in which case we use the command line settings).
83cce46b 1703
1704 procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
0bba2a3e 1705 -- This procedure restores a set of switch values previously saved by a
1706 -- call to Save_Opt_Switches.
83cce46b 1707
1708 procedure Register_Opt_Config_Switches;
3a2db8ab 1709 -- This procedure is called after processing the gnat.adc file and other
1710 -- configuration pragma files to record the values of the Config switches,
1711 -- as possibly modified by the use of command line switches and pragmas
1712 -- appearing in these files.
83cce46b 1713
1714 ------------------------
1715 -- Other Global Flags --
1716 ------------------------
1717
1718 Expander_Active : Boolean := False;
1719 -- A flag that indicates if expansion is active (True) or deactivated
1720 -- (False). When expansion is deactivated all calls to expander routines
1721 -- have no effect. Note that the initial setting of False is merely to
1722 -- prevent saving of an undefined value for an initial call to the
0bba2a3e 1723 -- Expander_Mode_Save_And_Set procedure. For more information on the use of
1724 -- this flag, see package Expander. Indeed this flag might more logically
1725 -- be in the spec of Expander, but it is referenced by Errout, and it
1726 -- really seems wrong for Errout to depend on Expander.
83cce46b 1727
fbc67f84 1728 Static_Dispatch_Tables : Boolean := True;
1729 -- This flag indicates if the backend supports generation of statically
1730 -- allocated dispatch tables. If it is True, then the front end will
1731 -- generate static aggregates for dispatch tables that contain forward
1732 -- references to addresses of subprograms not seen yet, and the back end
1733 -- must be prepared to handle this case. If it is False, then the front
1734 -- end generates assignments to initialize the dispatch table, and there
1735 -- are no such forward references. By default we build statically allocated
1736 -- dispatch tables for all library level tagged types in all platforms.This
1737 -- behavior can be disabled using switch -gnatd.t which will set this flag
1738 -- to False and revert to the previous dynamic behavior.
1739
83cce46b 1740 -----------------------
1741 -- Tree I/O Routines --
1742 -----------------------
1743
1744 procedure Tree_Read;
1745 -- Reads switch settings from current tree file using Tree_Read
1746
1747 procedure Tree_Write;
1748 -- Writes out switch settings to current tree file using Tree_Write
1749
9dfe12ae 1750 --------------------------
1751 -- ASIS Version Control --
1752 --------------------------
1753
1754 -- These two variables (Tree_Version_String and Tree_ASIS_Version_Number)
1755 -- are supposed to be used in the GNAT/ASIS version check performed in
1756 -- the ASIS code (this package is also a part of the ASIS implementation).
1757 -- They are set by Tree_Read procedure, so they represent the version
1758 -- number (and the version string) of the compiler which has created the
1759 -- tree, and they are supposed to be compared with the corresponding values
da336b70 1760 -- from the Tree_IO and Gnatvsn packages which also are a part of ASIS
1761 -- implementation.
9dfe12ae 1762
2e12de5f 1763 Tree_Version_String : String_Access;
0bba2a3e 1764 -- Used to store the compiler version string read from a tree file to check
2e12de5f 1765 -- if it is from the same date as stored in the version string in Gnatvsn.
1766 -- We require that ASIS Pro can be used only with GNAT Pro, but we allow
1767 -- non-Pro ASIS and ASIS-based tools to be used with any version of the
1768 -- GNAT compiler. Therefore, we need the possibility to compare the dates
1769 -- of the corresponding source sets, using version strings that may be
1770 -- of different lengths.
9dfe12ae 1771
1772 Tree_ASIS_Version_Number : Int;
1773 -- Used to store the ASIS version number read from a tree file to check if
da336b70 1774 -- it is the same as stored in the ASIS version number in Tree_IO.
9dfe12ae 1775
83cce46b 1776private
1777
2e12de5f 1778 -- The following type is used to save and restore settings of switches in
1779 -- Opt that represent the configuration (i.e. result of config pragmas).
1780
1781 -- Note that Ada_Version_Explicit is not included, since this is a sticky
1782 -- flag that once set does not get reset, since the whole idea of this flag
1783 -- is to record the setting for the main unit.
1784
83cce46b 1785 type Config_Switches_Type is record
e2aa7314 1786 Ada_Version : Ada_Version_Type;
0bba2a3e 1787 Ada_Version_Explicit : Ada_Version_Type;
1788 Assertions_Enabled : Boolean;
c9e9428a 1789 Assume_No_Invalid_Values : Boolean;
3a2db8ab 1790 Check_Policy_List : Node_Id;
5c6363c7 1791 Debug_Pragmas_Enabled : Boolean;
9dfe12ae 1792 Dynamic_Elaboration_Checks : Boolean;
1793 Exception_Locations_Suppressed : Boolean;
1794 Extensions_Allowed : Boolean;
1795 External_Name_Exp_Casing : External_Casing_Type;
1796 External_Name_Imp_Casing : External_Casing_Type;
9c5da18f 1797 Fast_Math : Boolean;
3feedf2a 1798 Init_Or_Norm_Scalars : Boolean;
1799 Initialize_Scalars : Boolean;
2253aba6 1800 Optimize_Alignment : Character;
3a2db8ab 1801 Optimize_Alignment_Local : Boolean;
0bba2a3e 1802 Persistent_BSS_Mode : Boolean;
9dfe12ae 1803 Polling_Required : Boolean;
da8b631d 1804 Short_Descriptors : Boolean;
9dfe12ae 1805 Use_VADS_Size : Boolean;
83cce46b 1806 end record;
1807
8255b799 1808 -- The following declarations are for GCC version dependent flags. We do
1809 -- not let client code in the compiler test GCC_Version directly, but
1810 -- instead use deferred constants for relevant feature tags.
1811
fbc67f84 1812 -- Note: there currently are no such constants defined in this section,
1813 -- since the compiler front end is currently entirely independent of the
1814 -- GCC version, which is a desirable state of affairs.
1815
8255b799 1816 function get_gcc_version return Int;
1817 pragma Import (C, get_gcc_version, "get_gcc_version");
1818
1819 GCC_Version : constant Nat := get_gcc_version;
1820 -- GNATMAKE
1821 -- Indicates which version of gcc is in use (3 = 3.x, 4 = 4.x). Note that
1822 -- gcc 2.8.1 (which used to be a value of 2) is no longer supported.
1823
83cce46b 1824end Opt;