OSDN Git Service

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