OSDN Git Service

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