FSF GCC merge 02/23/03
[official-gcc.git] / gcc / ada / opt.ads
blobc0b1b050f84c2708482cf6492f2eaca609c05736
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- O P T --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2002, Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
29 -- --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This package contains global flags set by the initialization
36 -- routine from the command line and referenced throughout the compiler,
37 -- the binder, gnatmake or other GNAT tools. The comments indicate which
38 -- options are used by which programs (GNAT, GNATBIND, GNATMAKE, etc).
40 with Hostparm; use Hostparm;
41 with Types; use Types;
42 with System.WCh_Con; use System.WCh_Con;
44 package Opt is
46 ----------------------------------------------
47 -- Settings of Modes for Current Processing --
48 ----------------------------------------------
50 -- The following mode values represent the current state of processing.
51 -- The values set here are the default values. Unless otherwise noted,
52 -- the value may be reset in Switch with an appropropiate switch. In
53 -- some cases, the values can also be modified by pragmas, and in the
54 -- case of some binder variables, Gnatbind.Scan_Bind_Arg may modify
55 -- the default values.
57 Ada_Bind_File : Boolean := True;
58 -- GNATBIND, GNATLINK
59 -- Set True if binder file to be generated in Ada rather than C
61 Ada_95 : Boolean := True;
62 -- GNAT
63 -- Set True if operating in Ada 95 mode
64 -- Set False if operating in Ada 83 mode
66 Ada_83 : Boolean := False;
67 -- GNAT
68 -- Set True if operating in Ada 83 mode
69 -- Set False if operating in Ada 95 mode
71 Ada_Final_Suffix : constant String := "final";
72 Ada_Final_Name : String_Ptr := new String'("ada" & Ada_Final_Suffix);
73 -- GNATBIND
74 -- The name of the procedure that performs the finalization at the end of
75 -- execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
77 Ada_Init_Suffix : constant String := "init";
78 Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix);
79 -- GNATBIND
80 -- The name of the procedure that performs initialization at the start
81 -- of execution. This variable may be modified by Gnatbind.Scan_Bind_Arg.
83 Ada_Main_Name_Suffix : constant String := "main";
84 -- GNATBIND
85 -- The suffix for Ada_Main_Name. Defined as a constant here so that it
86 -- can be referenced in a uniform manner to create either the default
87 -- value of Ada_Main_Name (declared below), or the non-default name
88 -- set by Gnatbind.Scan_Bind_Arg.
90 Ada_Main_Name : String_Ptr := new String'("ada_" & Ada_Main_Name_Suffix);
91 -- GNATBIND
92 -- The name of the Ada package generated by the binder (when in Ada mode).
93 -- This variable may be modified by Gnatbind.Scan_Bind_Arg.
95 Address_Clause_Overlay_Warnings : Boolean := True;
96 -- GNAT
97 -- Set False to disable address clause warnings
99 All_Errors_Mode : Boolean := False;
100 -- GNAT
101 -- Flag set to force display of multiple errors on a single line and
102 -- also repeated error messages for references to undefined identifiers
103 -- and certain other repeated error messages.
105 All_Sources : Boolean := False;
106 -- GNATBIND
107 -- Set to True to require all source files to be present. This flag is
108 -- directly modified by gnatmake to affect the shared binder routines.
110 Alternate_Main_Name : String_Ptr := null;
111 -- GNATBIND
112 -- Set to non null when Bind_Alternate_Main_Name is True. This value
113 -- is modified as needed by Gnatbind.Scan_Bind_Arg.
115 Assertions_Enabled : Boolean := False;
116 -- GNAT
117 -- Enable assertions made using pragma Assert.
119 Back_Annotate_Rep_Info : Boolean := False;
120 -- GNAT
121 -- If set True (by use of -gnatB), enables back annotation of
122 -- representation information by gigi, even in -gnatc mode.
124 Bind_Alternate_Main_Name : Boolean := False;
125 -- GNATBIND
126 -- True if main should be called Alternate_Main_Name.all.
127 -- This variable may be set to True by Gnatbind.Scan_Bind_Arg.
129 Bind_Main_Program : Boolean := True;
130 -- GNATBIND
131 -- Set to False if not binding main Ada program.
133 Bind_For_Library : Boolean := False;
134 -- GNATBIND
135 -- Set to True if the binder needs to generate a file designed for
136 -- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
138 Bind_Only : Boolean := False;
139 -- GNATMAKE
140 -- Set to True to skip compile and link steps
141 -- (except when Compile_Only and/or Link_Only are True).
143 Brief_Output : Boolean := False;
144 -- GNAT, GNATBIND
145 -- Force brief error messages to standard error, even if verbose mode is
146 -- set (so that main error messages go to standard output).
148 Check_Object_Consistency : Boolean := False;
149 -- GNATBIND, GNATMAKE
150 -- Set to True to check whether every object file is consistent with
151 -- its corresponding ada library information (ALI) file. An object
152 -- file is inconsistent with the corresponding ALI file if the object
153 -- file does not exist or if it has an older time stamp than the ALI file.
154 -- Default above is for GNATBIND. GNATMAKE overrides this default to
155 -- True (see Make.Initialize) since we normally do need to check source
156 -- consistencies in gnatmake.
158 Check_Only : Boolean := False;
159 -- GNATBIND
160 -- Set to True to do checks only, no output of binder file.
162 Check_Readonly_Files : Boolean := False;
163 -- GNATMAKE
164 -- Set to True to check readonly files during the make process.
166 Check_Source_Files : Boolean := True;
167 -- GNATBIND, GNATMAKE
168 -- Set to True to enable consistency checking for any source files that
169 -- are present (i.e. date must match the date in the library info file).
170 -- Set to False for object file consistency check only. This flag is
171 -- directly modified by gnatmake, to affect the shared binder routines.
173 Check_Switches : Boolean := False;
174 -- GNATMAKE
175 -- Set to True to check compiler options during the make process.
177 Check_Unreferenced : Boolean := False;
178 -- GNAT
179 -- Set to True to enable checking for unreferenced entities other
180 -- than formal parameters (for which see Check_Unreferenced_Formals)
182 Check_Unreferenced_Formals : Boolean := False;
183 -- GNAT
184 -- Set True to check for unreferenced formals. This is turned
185 -- on by -gnatwa/wf/wu and turned off by -gnatwA/wF/wU.
187 Check_Withs : Boolean := False;
188 -- GNAT
189 -- Set to True to enable checking for unused withs, and also the case
190 -- of withing a package and using none of the entities in the package.
192 Compile_Only : Boolean := False;
193 -- GNATMAKE
194 -- Set to True to skip bind and link steps (except when Bind_Only is True)
196 Compress_Debug_Names : Boolean := False;
197 -- GNAT
198 -- Set to True if the option to compress debug information is set (-gnatC)
200 Config_File : Boolean := True;
201 -- GNAT
202 -- Set to False to inhibit reading and processing of gnat.adc file
204 Config_File_Name : String_Ptr := null;
205 -- GNAT
206 -- File name of configuration pragmas file (given by switch -gnatec)
208 Constant_Condition_Warnings : Boolean := False;
209 -- GNAT
210 -- Set to True to activate warnings on constant conditions
212 Create_Mapping_File : Boolean := False;
213 -- GNATMAKE
214 -- Set to True (-C switch) to indicate that gnatmake
215 -- invokes the compiler with a mapping file (-gnatem compiler switch).
217 subtype Debug_Level_Value is Nat range 0 .. 3;
218 Debugger_Level : Debug_Level_Value := 0;
219 -- GNATBIND
220 -- The value given to the -g parameter.
221 -- The default value for -g with no value is 2
222 -- This is usually ignored by GNATBIND, except in the VMS version
223 -- where it is passed as an argument to __gnat_initialize to trigger
224 -- the activation of the remote debugging interface (is this true???).
226 Debug_Generated_Code : Boolean := False;
227 -- GNAT
228 -- Set True (-gnatD switch) to debug generated expanded code instead
229 -- of the original source code. Causes debugging information to be
230 -- written with respect to the generated code file that is written.
232 Display_Compilation_Progress : Boolean := False;
233 -- GNATMAKE
234 -- Set True (-d switch) to display information on progress while compiling
235 -- files. Internal flag to be used in conjunction with an IDE such as
236 -- Glide.
238 type Distribution_Stub_Mode_Type is
239 -- GNAT
240 (No_Stubs,
241 -- Normal mode, no generation/compilation of distribution stubs
243 Generate_Receiver_Stub_Body,
244 -- The unit being compiled is the RCI body, and the compiler will
245 -- generate the body for the receiver stubs and compile it.
247 Generate_Caller_Stub_Body);
248 -- The unit being compiled is the RCI spec, and the compiler will
249 -- generate the body for the caller stubs and compile it.
251 Distribution_Stub_Mode : Distribution_Stub_Mode_Type := No_Stubs;
252 -- GNAT
253 -- This enumeration variable indicates the five states of distribution
254 -- annex stub generation/compilation.
256 Do_Not_Execute : Boolean := False;
257 -- GNATMAKE
258 -- Set to True if no actual compilations should be undertaken.
260 Dynamic_Elaboration_Checks : Boolean := False;
261 -- GNAT
262 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
263 -- switch or by the use of pragma Elaboration_Checks (Dynamic).
265 Elab_Dependency_Output : Boolean := False;
266 -- GNATBIND
267 -- Set to True to output complete list of elaboration constraints
269 Elab_Order_Output : Boolean := False;
270 -- GNATBIND
271 -- Set to True to output chosen elaboration order
273 Elab_Warnings : Boolean := False;
274 -- GNAT
275 -- Set to True to generate full elaboration warnings (-gnatwl)
277 Enable_Overflow_Checks : Boolean := False;
278 -- GNAT
279 -- Set to True if -gnato (enable overflow checks) switch is set,
280 -- but not -gnatp.
282 type Exception_Mechanism_Type is (Setjmp_Longjmp, Front_End_ZCX, GCC_ZCX);
283 pragma Convention (C, Exception_Mechanism_Type);
285 Exception_Mechanism : Exception_Mechanism_Type := Setjmp_Longjmp;
286 -- GNAT
287 -- Set to the appropriate value depending on the default as given in
288 -- system.ads (ZCX_By_Default, GCC_ZCX_Support, Front_End_ZCX_Support)
289 -- and the use of -gnatL -gnatZ (and -gnatdX). The C convention is
290 -- there to make this variable accessible to gigi.
292 Exception_Tracebacks : Boolean := False;
293 -- GNATBIND
294 -- Set to True to store tracebacks in exception occurrences (-E)
296 Extensions_Allowed : Boolean := False;
297 -- GNAT
298 -- Set to True by switch -gnatX if GNAT specific language extensions
299 -- are allowed. For example, "with type" is a GNAT extension.
301 type External_Casing_Type is (
302 As_Is, -- External names cased as they appear in the Ada source
303 Uppercase, -- External names forced to all uppercase letters
304 Lowercase); -- External names forced to all lowercase letters
306 External_Name_Imp_Casing : External_Casing_Type := Lowercase;
307 -- GNAT
308 -- The setting of this flag determines the casing of external names
309 -- when the name is implicitly derived from an entity name (i.e. either
310 -- no explicit External_Name or Link_Name argument is used, or, in the
311 -- case of extended DEC pragmas, the external name is given using an
312 -- identifier. The As_Is setting is not permitted here (since this would
313 -- create Ada source programs that were case sensitive).
315 External_Name_Exp_Casing : External_Casing_Type := As_Is;
316 -- GNAT
317 -- The setting of this flag determines the casing of an external name
318 -- specified explicitly with a string literal. As_Is means the string
319 -- literal is used as given with no modification to the casing. If
320 -- Lowercase or Uppercase is set, then the string is forced to all
321 -- lowercase or all uppercase letters as appropriate. Note that this
322 -- setting has no effect if the external name is given using an identifier
323 -- in the case of extended DEC import/export pragmas (in this case the
324 -- casing is controlled by External_Name_Imp_Casing), and also has no
325 -- effect if an explicit Link_Name is supplied (a link name is always
326 -- used exactly as given).
328 Float_Format : Character := ' ';
329 -- GNAT
330 -- A non-blank value indicates that a Float_Format pragma has been
331 -- processed, in which case this variable is set to 'I' for IEEE or
332 -- to 'V' for VAX. The setting of 'V' is only possible on OpenVMS
333 -- versions of GNAT.
335 Float_Format_Long : Character := ' ';
336 -- GNAT
337 -- A non-blank value indicates that a Long_Float pragma has been
338 -- processed (this pragma is recognized only in OpenVMS versions
339 -- of GNAT), in which case this variable is set to D or G for
340 -- D_Float or G_Float.
342 Force_ALI_Tree_File : Boolean := False;
343 -- GNAT
344 -- Force generation of ALI file even if errors are encountered.
345 -- Also forces generation of tree file if -gnatt is also set.
347 Force_Compilations : Boolean := False;
348 -- GNATMAKE
349 -- Set to force recompilations even when the objects are up-to-date.
351 Force_RM_Elaboration_Order : Boolean := False;
352 -- GNATBIND
353 -- True if binding with forced RM elaboration order (-f switch set)
354 -- Note: this is considered an obsolescent option, to be removed in
355 -- some future release. It is no longer documented. The proper way
356 -- to get this effect is to use -gnatE and suppress elab checks.
358 Full_List : Boolean := False;
359 -- GNAT
360 -- Set True to generate full source listing with embedded errors
362 Global_Discard_Names : Boolean := False;
363 -- GNAT
364 -- Set true if a pragma Discard_Names applies to the current unit
366 GNAT_Mode : Boolean := False;
367 -- GNAT
368 -- True if compiling in GNAT system mode (-gnatg switch)
370 HLO_Active : Boolean := False;
371 -- GNAT
372 -- True if High Level Optimizer is activated (-gnatH switch)
374 Implementation_Unit_Warnings : Boolean := True;
375 -- GNAT
376 -- Set True to active warnings for use of implementation internal units.
377 -- Can be controlled by use of -gnatwi/-gnatwI.
379 Identifier_Character_Set : Character;
380 -- GNAT
381 -- This variable indicates the character set to be used for identifiers.
382 -- The possible settings are:
383 -- '1' Latin-5 (ISO-8859-1)
384 -- '2' Latin-5 (ISO-8859-2)
385 -- '3' Latin-5 (ISO-8859-3)
386 -- '4' Latin-5 (ISO-8859-4)
387 -- '5' Latin-5 (ISO-8859-5, Cyrillic)
388 -- '9' Latin-5 (ISO-8859-9)
389 -- 'p' PC (US, IBM page 437)
390 -- '8' PC (European, IBM page 850)
391 -- 'f' Full upper set (all distinct)
392 -- 'n' No upper characters (Ada/83 rules)
393 -- 'w' Latin-1 plus wide characters allowed in identifiers
395 -- The setting affects the set of letters allowed in identifiers and the
396 -- upper/lower case equivalences. It does not affect the interpretation of
397 -- character and string literals, which are always stored using the actual
398 -- coding in the source program. This variable is initialized to the
399 -- default value appropriate to the system (in Osint.Initialize), and then
400 -- reset if a command line switch is used to change the setting.
402 Ineffective_Inline_Warnings : Boolean := False;
403 -- GNAT
404 -- Set True to activate warnings if front-end inlining (-gnatN) is not
405 -- able to actually inline a particular call (or all calls). Can be
406 -- controlled by use of -gnatwp/-gnatwP.
408 Init_Or_Norm_Scalars : Boolean := False;
409 -- GNAT
410 -- Set True if a pragma Initialize_Scalars applies to the current unit.
411 -- Also set True if a pragma Normalize_Scalars applies.
413 Initialize_Scalars : Boolean := False;
414 -- GNAT
415 -- Set True if a pragma Initialize_Scalars applies to the current unit.
416 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
418 Initialize_Scalars_Mode : Character := 'I';
419 -- GNATBIND
420 -- Set to 'I' for -Sin (default), 'L' for -Slo, 'H' for -Shi, 'X' for -Sxx
422 Initialize_Scalars_Val : String (1 .. 2);
423 -- GNATBIND
424 -- Valid only if Initialize_Scalars_Mode is set to 'X' (-Shh). Contains
425 -- the two hex bytes from the -Shh switch.
427 Inline_Active : Boolean := False;
428 -- GNAT
429 -- Set True to activate pragma Inline processing across modules. Default
430 -- for now is not to inline across module boundaries.
432 Front_End_Inlining : Boolean := False;
433 -- GNAT
434 -- Set True to activate inlining by front-end expansion.
436 Inline_Processing_Required : Boolean := False;
437 -- GNAT
438 -- Set True if inline processing is required. Inline processing is
439 -- required if an active Inline pragma is processed. The flag is set
440 -- for a pragma Inline or Inline_Always that is actually active.
442 In_Place_Mode : Boolean := False;
443 -- GNATMAKE
444 -- Set True to store ALI and object files in place ie in the object
445 -- directory if these files already exist or in the source directory
446 -- if not.
448 Keep_Going : Boolean := False;
449 -- GNATMAKE
450 -- When True signals gnatmake to ignore compilation errors and keep
451 -- processing sources until there is no more work.
453 Link_Only : Boolean := False;
454 -- GNATMAKE
455 -- Set to True to skip compile and bind steps
456 -- (except when Bind_Only is set to True).
458 List_Restrictions : Boolean := False;
459 -- GNATBIND
460 -- Set to True to list restrictions pragmas that could apply to partition
462 List_Units : Boolean := False;
463 -- GNAT
464 -- List units in the active library for a compilation (-gnatu switch)
466 List_Dependencies : Boolean := False;
467 -- GNATMAKE
468 -- When True gnatmake verifies that the objects are up to date and
469 -- outputs the list of object dependencies (-M switch).
470 -- Output depends if -a switch is used or not.
471 -- This list can be used directly in a Makefile.
473 List_Representation_Info : Int range 0 .. 3 := 0;
474 -- GNAT
475 -- Set non-zero by -gnatR switch to list representation information.
476 -- The settings are as follows:
478 -- 0 = no listing of representation information (default as above)
479 -- 1 = list rep info for user defined record and array types
480 -- 2 = list rep info for all user defined types and objects
481 -- 3 = like 2, but variable fields are decoded symbolically
483 List_Representation_Info_To_File : Boolean := False;
484 -- GNAT
485 -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3
486 -- to be written to file.rep (where file is the name of the source
487 -- file) instead of stdout. For example, if file x.adb is compiled
488 -- using -gnatR2s then representation info is written to x.adb.ref.
490 type Creat_Repinfo_File_Proc is access procedure (Src : File_Name_Type);
491 type Write_Repinfo_Line_Proc is access procedure (Info : String);
492 type Close_Repinfo_File_Proc is access procedure;
493 -- Types used for procedure addresses below
495 Creat_Repinfo_File_Access : Creat_Repinfo_File_Proc := null;
496 Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null;
497 Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null;
498 -- GNAT
499 -- These three locations are left null when operating in non-compiler
500 -- (e.g. ASIS mode), but when operating in compiler mode, they are
501 -- set to point to the three corresponding procedures in Osint. The
502 -- reason for this slightly strange interface is to prevent Repinfo
503 -- from dragging in Osint in ASIS mode, which would include a lot of
504 -- unwanted units in the ASIS build.
506 Locking_Policy : Character := ' ';
507 -- GNAT
508 -- Set to ' ' for the default case (no locking policy specified).
509 -- Reset to first character (uppercase) of locking policy name if a
510 -- valid pragma Locking_Policy is encountered.
512 Look_In_Primary_Dir : Boolean := True;
513 -- GNAT, GNATBIND, GNATMAKE
514 -- Set to False if a -I- was present on the command line.
515 -- When True we are allowed to look in the primary directory to locate
516 -- other source or library files.
518 Mapping_File_Name : String_Ptr := null;
519 -- GNAT
520 -- File name of mapping between unit names, file names and path names.
521 -- (given by switch -gnatem)
523 Maximum_Errors : Int := 9999;
524 -- GNAT, GNATBIND
525 -- Maximum number of errors before compilation is terminated
527 Maximum_File_Name_Length : Int;
528 -- GNAT, GNATBIND
529 -- Maximum number of characters allowed in a file name, not counting the
530 -- extension, as set by the appropriate switch. If no switch is given,
531 -- then this value is initialized by Osint to the appropriate value.
533 Maximum_Processes : Positive := 1;
534 -- GNATMAKE
535 -- Maximum number of processes that should be spawned to carry out
536 -- compilations.
538 Minimal_Recompilation : Boolean := False;
539 -- GNATMAKE
540 -- Set to True if minimal recompilation mode requested.
542 No_Stdlib : Boolean := False;
543 -- GNATMAKE, GNATBIND, GNATFIND, GNATXREF
544 -- Set to True if no default library search dirs added to search list.
546 No_Stdinc : Boolean := False;
547 -- GNAT, GNATBIND, GNATMAKE, GNATFIND, GNATXREF
548 -- Set to True if no default source search dirs added to search list.
550 No_Main_Subprogram : Boolean := False;
551 -- GNATMAKE, GNATBIND
552 -- Set to True if compilation/binding of a program without main
553 -- subprogram requested.
555 Normalize_Scalars : Boolean := False;
556 -- GNAT
557 -- Set True if a pragma Normalize_Scalars applies to the current unit.
558 -- Note that Init_Or_Norm_Scalars is also set to True if this is True.
560 No_Run_Time : Boolean := False;
561 -- GNAT
562 -- Set True if a valid pragma No_Run_Time is processed or if the
563 -- flag Targparm.High_Integrity_Mode_On_Target is set True.
565 type Operating_Mode_Type is (Check_Syntax, Check_Semantics, Generate_Code);
566 Operating_Mode : Operating_Mode_Type := Generate_Code;
567 -- GNAT
568 -- Indicates the operating mode of the compiler. The default is generate
569 -- code, which runs the parser, semantics and backend. Switches can be
570 -- used to set syntax checking only mode, or syntax and semantics checking
571 -- only mode. Operating_Mode can also be modified as a result of detecting
572 -- errors during the compilation process. In particular if any error is
573 -- detected then this flag is reset from Generate_Code to Check_Semantics
574 -- after generating an error message.
576 Output_File_Name_Present : Boolean := False;
577 -- GNATBIND, GNAT, GNATMAKE
578 -- Set to True when the output C file name is given with option -o
579 -- for GNATBIND, when the object file name is given with option
580 -- -gnatO for GNAT or when the executable is given with option -o
581 -- for GNATMAKE.
583 Output_Linker_Option_List : Boolean := False;
584 -- GNATBIND
585 -- True if output of list of linker options is requested (-K switch set)
587 Output_Object_List : Boolean := False;
588 -- GNATBIND
589 -- True if output of list of objects is requested (-O switch set)
591 Pessimistic_Elab_Order : Boolean := False;
592 -- GNATBIND
593 -- True if pessimistic elaboration order is to be chosen (-p switch set)
595 Polling_Required : Boolean := False;
596 -- GNAT
597 -- Set to True if polling for asynchronous abort is enabled by using
598 -- the -gnatP option for GNAT.
600 Print_Generated_Code : Boolean := False;
601 -- GNAT
602 -- Set to True to enable output of generated code in source form. This
603 -- flag is set by the -gnatG switch.
605 Propagate_Exceptions : Boolean := False;
606 -- GNAT
607 -- Indicates if subprogram descriptor exception tables should be
608 -- built for imported subprograms. Set True if a Propagate_Exceptions
609 -- pragma applies to the extended main unit.
611 Queuing_Policy : Character := ' ';
612 -- GNAT
613 -- Set to ' ' for the default case (no queuing policy specified).
614 -- Reset to first character (uppercase) of locking policy name if a valid
615 -- Queuing_Policy pragma is encountered.
617 Quiet_Output : Boolean := False;
618 -- GNATMAKE
619 -- Set to True if the list of compilation commands should not be output.
621 RTS_Switch : Boolean := False;
622 -- GNAT, GNATMAKE, GNATBIND, GNATLS, GNATFIND, GNATXREF
623 -- Set to True when the --RTS switch is set
625 Shared_Libgnat : Boolean;
626 -- GNATBIND
627 -- Set to True if a shared libgnat is requested by using the -shared
628 -- option for GNATBIND and to False when using the -static option. The
629 -- value of this flag is set by Gnatbind.Scan_Bind_Arg.
631 Stack_Checking_Enabled : Boolean;
632 -- GNAT
633 -- Set to indicate if -fstack-check switch is set for the compilation.
634 -- True means that the switch is set, so that stack checking is enabled.
635 -- False means that the switch is not set (no stack checking). This
636 -- value is obtained from the external imported value flag_stack_check
637 -- in the gcc backend (see Frontend) and may be referenced throughout
638 -- the compilation phases.
640 Style_Check : Boolean := False;
641 -- GNAT
642 -- Set True to perform style checks. Activates checks carried out
643 -- in package Style (see body of this package for details of checks)
644 -- This flag is set True by either the -gnatg or -gnaty switches.
646 System_Extend_Pragma_Arg : Node_Id := Empty;
647 -- GNAT
648 -- Set non-empty if and only if a correct Extend_System pragma was present
649 -- in which case it points to the argument of the pragma, and the name can
650 -- be located as Chars (Expression (System_Extend_Pragma_Arg)).
652 Subunits_Missing : Boolean := False;
653 -- GNAT
654 -- This flag is set true if missing subunits are detected with code
655 -- generation active. This causes code generation to be skipped.
657 Suppress_Checks : Boolean := False;
658 -- GNAT
659 -- Set to True if -gnatp (suppress all checks) switch present.
661 Suppress_Options : Suppress_Record;
662 -- GNAT
663 -- Flags set True to suppress corresponding check, i.e. add an implicit
664 -- pragma Suppress at the outer level of each unit compiled. Note that
665 -- these suppress actions can be overridden by the use of the Unsuppress
666 -- pragma. This variable is initialized by Osint.Initialize.
668 Table_Factor : Int := 1;
669 -- GNAT
670 -- Factor by which all initial table sizes set in Alloc are multiplied.
671 -- Used in Table to calculate initial table sizes (the initial table
672 -- size is the value in Alloc, used as the Table_Initial parameter
673 -- value, multiplied by the factor given here. The default value is
674 -- used if no -gnatT switch appears.
676 Task_Dispatching_Policy : Character := ' ';
677 -- GNAT
678 -- Set to ' ' for the default case (no task dispatching policy specified).
679 -- Reset to first character (uppercase) of task dispatching policy name
680 -- if a valid Task_Dispatching_Policy pragma is encountered.
682 Tasking_Used : Boolean := False;
683 -- Set True if any tasking construct is encountered. Used to activate the
684 -- output of the Q, L and T lines in ALI files.
686 Time_Slice_Set : Boolean := False;
687 -- GNATBIND
688 -- Set True if a pragma Time_Slice is processed in the main unit, or
689 -- if the -gnatTnn switch is present to set a time slice value.
691 Time_Slice_Value : Nat;
692 -- GNATBIND
693 -- Time slice value. Valid only if Time_Slice_Set is True, i.e. if a
694 -- Time_Slice pragma has been processed. Set to the time slice value
695 -- in microseconds. Negative values are stored as zero, and the value
696 -- is not larger than 1_000_000_000 (1000 seconds). Values larger than
697 -- this are reset to this maximum. This can also be set with the -gnatTnn
698 -- switch.
700 Tolerate_Consistency_Errors : Boolean := False;
701 -- GNATBIND
702 -- Tolerate time stamp and other consistency errors. If this flag is
703 -- set to True (-t), then inconsistencies result in warnings rather than
704 -- errors.
706 Tree_Output : Boolean := False;
707 -- GNAT
708 -- Set to True (-gnatt) to generate output tree file
710 Try_Semantics : Boolean := False;
711 -- GNAT
712 -- Flag set to force attempt at semantic analysis, even if parser errors
713 -- occur. This will probably cause blowups at this stage in the game. On
714 -- the other hand, most such blowups will be caught cleanly and simply
715 -- say compilation abandoned. This flag is set to True by -gnatq or -gnatQ.
717 Unique_Error_Tag : Boolean := Tag_Errors;
718 -- GNAT
719 -- Indicates if error messages are to be prefixed by the string error:
720 -- Initialized from Tag_Errors, can be forced on with the -gnatU switch.
722 Unreserve_All_Interrupts : Boolean := False;
723 -- GNAT, GNATBIND
724 -- Normally set False, set True if a valid Unreserve_All_Interrupts
725 -- pragma appears anywhere in the main unit for GNAT, or if any ALI
726 -- file has the corresponding attribute set in GNATBIND.
728 Upper_Half_Encoding : Boolean := False;
729 -- GNAT
730 -- Normally set False, indicating that upper half ASCII characters are
731 -- used in the normal way to represent themselves. If the wide character
732 -- encoding method uses the upper bit for this encoding, then this flag
733 -- is set True, and upper half characters in the source indicate the
734 -- start of a wide character sequence.
736 Usage_Requested : Boolean := False;
737 -- GNAT, GNATBIND, GNATMAKE
738 -- Set to True if -h (-gnath for the compiler) switch encountered
739 -- requesting usage information
741 Use_VADS_Size : Boolean := False;
742 -- GNAT
743 -- Set to True if a valid pragma Use_VADS_Size is processed
745 Validity_Checks_On : Boolean := True;
746 -- GNAT
747 -- This flag determines if validity checking is on or off. The initial
748 -- state is on, and the required default validity checks are active. The
749 -- actual set of checks that is performed if Validity_Checks_On is set
750 -- is defined by the switches in package Sem_Val. The Validity_Checks_On
751 -- flag is controlled by pragma Validity_Checks (On | Off), and also
752 -- some generated compiler code (typically code that has to do with
753 -- validity check generation) is compiled with this flag set to False.
754 -- This flag is set to False by the -gnatp switch.
756 Verbose_Mode : Boolean := False;
757 -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATCHOP, GNATNAME
758 -- Set to True to get verbose mode (full error message text and location
759 -- information sent to standard output, also header, copyright and summary)
761 Warn_On_Biased_Rounding : Boolean := False;
762 -- GNAT
763 -- Set to True to generate warnings for static constants that are rounded
764 -- in a manner inconsistent with unbiased rounding (round to even). Can
765 -- be modified by use of -gnatwb/B.
767 Warn_On_Dereference : Boolean := False;
768 -- GNAT
769 -- Set to True to generate warnings for implicit dereferences for array
770 -- indexing and record component access. Modified by use of -gnatwd/D.
772 Warn_On_Hiding : Boolean := False;
773 -- GNAT
774 -- Set to True to generate warnings if a declared entity hides another
775 -- entity. The default is that this warning is suppressed.
777 Warn_On_Redundant_Constructs : Boolean := False;
778 -- GNAT
779 -- Set to True to generate warnings for redundant constructs (e.g. useless
780 -- assignments/conversions). The default is that this warning is disabled.
782 type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error);
783 Warning_Mode : Warning_Mode_Type := Normal;
784 -- GNAT, GNATBIND
785 -- Controls treatment of warning messages. If set to Suppress, warning
786 -- messages are not generated at all. In Normal mode, they are generated
787 -- but do not count as errors. In Treat_As_Error mode, warning messages
788 -- are generated and are treated as errors.
790 Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets;
791 -- GNAT
792 -- Method used for encoding wide characters in the source program. See
793 -- description of type in unit System.WCh_Con for a list of the methods
794 -- that are currently supported. Note that brackets notation is always
795 -- recognized in source programs regardless of the setting of this
796 -- variable. The default setting causes only the brackets notation
797 -- to be recognized. If this is the main unit, this setting also
798 -- controls the output of the W=? parameter in the ALI file, which
799 -- is used to provide the default for Wide_Text_IO files.
801 Xref_Active : Boolean := True;
802 -- GNAT
803 -- Set if cross-referencing is enabled (i.e. xref info in ALI files)
805 Zero_Cost_Exceptions_Val : Boolean;
806 Zero_Cost_Exceptions_Set : Boolean := False;
807 -- GNAT
808 -- These values are to record the setting of the zero cost exception
809 -- handling mode set by argument switches (-gnatZ/-gnatL). If the
810 -- value is set by one of these switches, then Zero_Cost_Exceptions_Set
811 -- is set to True, and Zero_Cost_Exceptions_Val indicates the setting.
813 ----------------------------
814 -- Configuration Settings --
815 ----------------------------
817 -- These are settings that are used to establish the mode at the start
818 -- of each unit. The values defined below can be affected either by
819 -- command line switches, or by the use of appropriate configuration
820 -- pragmas in the gnat.adc file.
822 Ada_83_Config : Boolean;
823 -- GNAT
824 -- This is the value of the configuration switch for Ada 83 mode, as set
825 -- by the command line switch -gnat83, and possibly modified by the use
826 -- of configuration pragmas Ada_95 and Ada_83 in the gnat.adc file. This
827 -- switch is used to set the initial value for Ada_83 mode at the start
828 -- of analysis of a unit. Note however, that the setting of this flag
829 -- is ignored for internal and predefined units (which are always compiled
830 -- in Ada 95 mode).
832 Dynamic_Elaboration_Checks_Config : Boolean := False;
833 -- GNAT
834 -- Set True for dynamic elaboration checking mode, as set by the -gnatE
835 -- switch or by the use of pragma Elaboration_Checking (Dynamic).
837 Extensions_Allowed_Config : Boolean;
838 -- GNAT
839 -- This is the flag that indicates whether extensions are allowed.
840 -- It can be set True either by use of the -gnatX switch, or by use
841 -- of the configuration pragma Extensions_Allowed (On). It is always
842 -- set to True for internal GNAT units, since extensions are always
843 -- permitted in such units.
845 External_Name_Exp_Casing_Config : External_Casing_Type;
846 -- GNAT
847 -- This is the value of the configuration switch that controls casing
848 -- of external symbols for which an explicit external name is given. It
849 -- can be set to Uppercase by the command line switch -gnatF, and further
850 -- modified by the use of the configuration pragma External_Name_Casing
851 -- in the gnat.adc file. This flag is used to set the initial value
852 -- for External_Name_Exp_Casing at the start of analyzing each unit.
853 -- Note however that the setting of this flag is ignored for internal
854 -- and predefined units (which are always compiled with As_Is mode).
856 External_Name_Imp_Casing_Config : External_Casing_Type;
857 -- GNAT
858 -- This is the value of the configuration switch that controls casing
859 -- of external symbols where the external name is implicitly given. It
860 -- can be set to Uppercase by the command line switch -gnatF, and further
861 -- modified by the use of the configuration pragma External_Name_Casing
862 -- in the gnat.adc file. This flag is used to set the initial value
863 -- for External_Name_Imp_Casing at the start of analyzing each unit.
864 -- Note however that the setting of this flag is ignored for internal
865 -- and predefined units (which are always compiled with Lowercase mode).
867 Polling_Required_Config : Boolean;
868 -- GNAT
869 -- This is the value of the configuration switch that controls polling
870 -- mode. It can be set True by the command line switch -gnatP, and then
871 -- further modified by the use of pragma Polling in the gnat.adc file.
872 -- This flag is used to set the initial value for Polling_Required
873 -- at the start of analyzing each unit.
875 Use_VADS_Size_Config : Boolean;
876 -- GNAT
877 -- This is the value of the configuration switch that controls the use
878 -- of VADS_Size instead of Size whereever the attribute Size is used.
879 -- It can be set True by the use of the pragma Use_VADS_Size in the
880 -- gnat.adc file. This flag is used to set the initial value for
881 -- Use_VADS_Size at the start of analyzing each unit. Note however that
882 -- the setting of this flag is ignored for internal and predefined
883 -- units (which are always compiled with the standard Size semantics).
885 type Config_Switches_Type is private;
886 -- Type used to save values of the switches set from Config values
888 procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type);
889 -- This procedure saves the current values of the switches which are
890 -- initialized from the above Config values, and then resets these
891 -- switches according to the Config value settings.
893 procedure Set_Opt_Config_Switches (Internal_Unit : Boolean);
894 -- This procedure sets the switches to the appropriate initial values.
895 -- The parameter Internal_Unit is True for an internal or predefined
896 -- unit, and affects the way the switches are set (see above).
898 procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
899 -- This procedure restores a set of switch values previously saved
900 -- by a call to Save_Opt_Switches.
902 procedure Register_Opt_Config_Switches;
903 -- This procedure is called after processing the gnat.adc file to record
904 -- the values of the Config switches, as possibly modified by the use
905 -- of command line switches and configuration pragmas.
907 ------------------------
908 -- Other Global Flags --
909 ------------------------
911 Expander_Active : Boolean := False;
912 -- A flag that indicates if expansion is active (True) or deactivated
913 -- (False). When expansion is deactivated all calls to expander routines
914 -- have no effect. Note that the initial setting of False is merely to
915 -- prevent saving of an undefined value for an initial call to the
916 -- Expander_Mode_Save_And_Set procedure. For more information on the
917 -- use of this flag, see package Expander. Indeed this flag might more
918 -- logically be in the spec of Expander, but it is referenced by Errout,
919 -- and it really seems wrong for Errout to depend on Expander.
921 -----------------------
922 -- Tree I/O Routines --
923 -----------------------
925 procedure Tree_Read;
926 -- Reads switch settings from current tree file using Tree_Read
928 procedure Tree_Write;
929 -- Writes out switch settings to current tree file using Tree_Write
931 private
933 type Config_Switches_Type is record
934 Ada_83 : Boolean;
935 Dynamic_Elaboration_Checks : Boolean;
936 Extensions_Allowed : Boolean;
937 External_Name_Exp_Casing : External_Casing_Type;
938 External_Name_Imp_Casing : External_Casing_Type;
939 Polling_Required : Boolean;
940 Use_VADS_Size : Boolean;
941 end record;
943 end Opt;