1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                                D E B U G                                 --
6--                                                                          --
7--                                 B o d y                                  --
8--                                                                          --
9--          Copyright (C) 1992-2019, 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 3,  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.                                     --
17--                                                                          --
18-- As a special exception under Section 7 of GPL version 3, you are granted --
19-- additional permissions described in the GCC Runtime Library Exception,   --
20-- version 3.1, as published by the Free Software Foundation.               --
21--                                                                          --
22-- You should have received a copy of the GNU General Public License and    --
23-- a copy of the GCC Runtime Library Exception along with this program;     --
24-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25-- <http://www.gnu.org/licenses/>.                                          --
26--                                                                          --
27-- GNAT was originally developed  by the GNAT team at  New York University. --
28-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29--                                                                          --
30------------------------------------------------------------------------------
31
32package body Debug is
33
34   ---------------------------------
35   -- Summary of Debug Flag Usage --
36   ---------------------------------
37
38   --  Debug flags for compiler (GNAT1)
39
40   --  da   Generate messages tracking semantic analyzer progress
41   --  db   Show encoding of type names for debug output
42   --  dc   List names of units as they are compiled
43   --  dd   Dynamic allocation of tables messages generated
44   --  de   List the entity table
45   --  df   Full tree/source print (includes withed units)
46   --  dg   Print source from tree (generated code only)
47   --  dh   Generate listing showing loading of name table hash chains
48   --  di   Generate messages for visibility linking/delinking
49   --  dj   Suppress "junk null check" for access parameter values
50   --  dk   Generate GNATBUG message on abort, even if previous errors
51   --  dl   Generate unit load trace messages
52   --  dm   Prevent special frontend inlining in GNATprove mode
53   --  dn   Generate messages for node/list allocation
54   --  do   Print source from tree (original code only)
55   --  dp   Generate messages for parser scope stack push/pops
56   --  dq   No auto-alignment of small records
57   --  dr   Generate parser resynchronization messages
58   --  ds   Print source from tree (including original and generated stuff)
59   --  dt   Print full tree
60   --  du   Uncheck categorization pragmas
61   --  dv   Output trace of overload resolution
62   --  dw   Print trace of semantic scope stack
63   --  dx   Force expansion on, even if no code being generated
64   --  dy   Print tree of package Standard
65   --  dz   Print source of package Standard
66
67   --  dA   All entities included in representation information output
68   --  dB   Output debug encoding of type names and variants
69   --  dC   Output debugging information on check suppression
70   --  dD   Delete elaboration checks in inner level routines
71   --  dE   Apply elaboration checks to predefined units
72   --  dF   Perform the new SPARK checking rules for pointer aliasing
73   --  dG   Generate all warnings including those normally suppressed
74   --  dH   Hold (kill) call to gigi
75   --  dI   Inhibit internal name numbering in gnatG listing
76   --  dJ   Prepend subprogram name in messages
77   --  dK   Kill all error messages
78   --  dL   Ignore external calls from instances for elaboration
79   --  dM   Assume all variables are modified (no current values)
80   --  dN   No file name information in exception messages
81   --  dO   Output immediate error messages
82   --  dP   Do not check for controlled objects in preelaborable packages
83   --  dQ   Use old secondary stack method
84   --  dR   Bypass check for correct version of s-rpc
85   --  dS   Never convert numbers to machine numbers in Sem_Eval
86   --  dT   Convert to machine numbers only for constant declarations
87   --  dU   Enable garbage collection of unreachable entities
88   --  dV   Enable viewing of all symbols in debugger
89   --  dW   Disable warnings on calls for IN OUT parameters
90   --  dX   Display messages on reads of potentially uninitialized scalars
91   --  dY   Enable configurable run-time mode
92   --  dZ   Generate listing showing the contents of the dispatch tables
93
94   --  d.a  Force Target_Strict_Alignment mode to True
95   --  d.b  Dump backend types
96   --  d.c  Generate inline concatenation, do not call procedure
97   --  d.d  Disable atomic synchronization
98   --  d.e  Enable atomic synchronization
99   --  d.f  Inhibit folding of static expressions
100   --  d.g  Enable conversion of raise into goto
101   --  d.h  Minimize the creation of public internal symbols for concatenation
102   --  d.i  Ignore Warnings pragmas
103   --  d.j  Generate listing of frontend inlined calls
104   --  d.k  Kill referenced run-time library unit line numbers
105   --  d.l  Use Ada 95 semantics for limited function returns
106   --  d.m  For -gnatl, print full source only for main unit
107   --  d.n  Print source file names
108   --  d.o  Conservative elaboration order for indirect calls
109   --  d.p  Use original Ada 95 semantics for Bit_Order (disable AI95-0133)
110   --  d.q  Suppress optimizations on imported 'in'
111   --  d.r  Disable reordering of components in record types
112   --  d.s  Strict secondary stack management
113   --  d.t  Disable static allocation of library level dispatch tables
114   --  d.u  Enable Modify_Tree_For_C (update tree for c)
115   --  d.v  Enforce SPARK elaboration rules in SPARK code
116   --  d.w  Do not check for infinite loops
117   --  d.x  No exception handlers
118   --  d.y  Disable implicit pragma Elaborate_All on task bodies
119   --  d.z  Restore previous support for frontend handling of Inline_Always
120
121   --  d.A  Read/write Aspect_Specifications hash table to tree
122   --  d.B  Generate a bug box on abort_statement
123   --  d.C  Generate concatenation call, do not generate inline code
124   --  d.D  Disable errors on use of overriding keyword in Ada 95 mode
125   --  d.E  Turn selected errors into warnings
126   --  d.F  Debug mode for GNATprove
127   --  d.G  Ignore calls through generic formal parameters for elaboration
128   --  d.H  GNSA mode for ASIS
129   --  d.I  Do not ignore enum representation clauses in CodePeer mode
130   --  d.J  Relaxed rules for pragma No_Return
131   --  d.K
132   --  d.L  Depend on back end for limited types in if and case expressions
133   --  d.M  Relaxed RM semantics
134   --  d.N  Add node to all entities
135   --  d.O  Dump internal SCO tables
136   --  d.P  Previous (non-optimized) handling of length comparisons
137   --  d.Q  Previous (incomplete) style check for binary operators
138   --  d.R  Restrictions in ali files in positional form
139   --  d.S  Force Optimize_Alignment (Space)
140   --  d.T  Force Optimize_Alignment (Time)
141   --  d.U  Ignore indirect calls for static elaboration
142   --  d.V  Do not verify validity of SCIL files (CodePeer mode)
143   --  d.W  Print out debugging information for Walk_Library_Items
144   --  d.X  Old treatment of indexing aspects
145   --  d.Y
146   --  d.Z  Do not enable expansion in configurable run-time mode
147
148   --  d_a  Stop elaboration checks on accept or select statement
149   --  d_b
150   --  d_c
151   --  d_d
152   --  d_e  Ignore entry calls and requeue statements for elaboration
153   --  d_f  Issue info messages related to GNATprove usage
154   --  d_g
155   --  d_h
156   --  d_i  Ignore activations and calls to instances for elaboration
157   --  d_j  Read JSON files and populate Repinfo tables (opposite of -gnatRjs)
158   --  d_k
159   --  d_l
160   --  d_m
161   --  d_n
162   --  d_o
163   --  d_p  Ignore assertion pragmas for elaboration
164   --  d_q
165   --  d_r
166   --  d_s  Stop elaboration checks on synchronous suspension
167   --  d_t
168   --  d_u
169   --  d_v
170   --  d_w
171   --  d_x
172   --  d_y
173   --  d_z
174
175   --  d_A  Stop generation of ALI file
176   --  d_B
177   --  d_C
178   --  d_D
179   --  d_E
180   --  d_F  Encode full invocation paths in ALI files
181   --  d_G
182   --  d_H
183   --  d_I
184   --  d_J
185   --  d_K  (Reserved) Enable reporting a warning on known-problem issues
186   --  d_L  Output trace information on elaboration checking
187   --  d_M
188   --  d_N
189   --  d_O
190   --  d_P
191   --  d_Q
192   --  d_R
193   --  d_S
194   --  d_T  Output trace information on invocation path recording
195   --  d_U
196   --  d_V
197   --  d_W
198   --  d_X
199   --  d_Y
200   --  d_Z
201
202   --  d1   Error msgs have node numbers where possible
203   --  d2   Eliminate error flags in verbose form error messages
204   --  d3   Dump bad node in Comperr on an abort
205   --  d4   Inhibit automatic krunch of predefined library unit files
206   --  d5   Debug output for tree read/write
207   --  d6   Default access unconstrained to thin pointers
208   --  d7   Suppress version/source stamp/compilation time for -gnatv/-gnatl
209   --  d8   Force opposite endianness in packed stuff
210   --  d9   Allow lock free implementation
211
212   --  d.1  Enable unnesting of nested procedures
213   --  d.2  Allow statements in declarative part
214   --  d.3  Output debugging information from Exp_Unst
215   --  d.4  Do not delete generated C file in case of errors
216   --  d.5  Do not generate imported subprogram definitions in C code
217   --  d.6  Do not avoid declaring unreferenced types in C code
218   --  d.7  Disable unsound heuristics in gnat2scil (for CP as SPARK prover)
219   --  d.8
220   --  d.9  Disable build-in-place for nonlimited types
221
222   --  d_1
223   --  d_2
224   --  d_3
225   --  d_4
226   --  d_5
227   --  d_6
228   --  d_7
229   --  d_8
230   --  d_9
231
232   --  Debug flags for binder (GNATBIND)
233
234   --  da  All links (including internal units) listed if there is a cycle
235   --  db  Output information from Better_Choice
236   --  dc  List units as they are chosen
237   --  dd
238   --  de  Elaboration dependencies including system units
239   --  df
240   --  dg
241   --  dh
242   --  di  Ignore_Errors mode for reading ali files
243   --  dj
244   --  dk
245   --  dl
246   --  dm
247   --  dn  List details of manipulation of Num_Pred values
248   --  do  Use older preference for elaboration order
249   --  dp  Use old preference for elaboration order
250   --  dq
251   --  dr
252   --  ds
253   --  dt
254   --  du  List units as they are acquired
255   --  dv  Verbose debugging printouts
256   --  dw
257   --  dx  Force binder to read xref information from ali files
258   --  dy
259   --  dz
260
261   --  dA
262   --  dB
263   --  dC
264   --  dD
265   --  dE
266   --  dF
267   --  dG
268   --  dH
269   --  dI
270   --  dJ
271   --  dK
272   --  dL
273   --  dM
274   --  dN
275   --  dO
276   --  dP
277   --  dQ
278   --  dR
279   --  dS
280   --  dT
281   --  dU
282   --  dV
283   --  dW
284   --  dX
285   --  dY
286   --  dZ
287
288   --  d.a
289   --  d.b
290   --  d.c
291   --  d.d
292   --  d.e
293   --  d.f
294   --  d.g
295   --  d.h
296   --  d.i
297   --  d.j
298   --  d.k
299   --  d.l
300   --  d.m
301   --  d.n
302   --  d.o
303   --  d.p
304   --  d.q
305   --  d.r
306   --  d.s
307   --  d.t
308   --  d.u
309   --  d.v
310   --  d.w
311   --  d.x
312   --  d.y
313   --  d.z
314
315   --  d.A
316   --  d.B
317   --  d.C
318   --  d.D
319   --  d.E
320   --  d.F
321   --  d.G
322   --  d.H
323   --  d.I
324   --  d.J
325   --  d.K
326   --  d.L
327   --  d.M
328   --  d.N
329   --  d.O
330   --  d.P
331   --  d.Q
332   --  d.R
333   --  d.S
334   --  d.T
335   --  d.U
336   --  d.V
337   --  d.W
338   --  d.X
339   --  d.Y
340   --  d.Z
341
342   --  d.1
343   --  d.2
344   --  d.3
345   --  d.4
346   --  d.5
347   --  d.6
348   --  d.7
349   --  d.8
350   --  d.9
351
352   --  d_a  Ignore the effects of pragma Elaborate_All
353   --  d_b  Ignore the effects of pragma Elaborate_Body
354   --  d_c
355   --  d_d
356   --  d_e  Ignore the effects of pragma Elaborate
357   --  d_f
358   --  d_g
359   --  d_h
360   --  d_i
361   --  d_j
362   --  d_k
363   --  d_l
364   --  d_m
365   --  d_n
366   --  d_o
367   --  d_p
368   --  d_q
369   --  d_r
370   --  d_s
371   --  d_t  Output cycle-detection trace information
372   --  d_u
373   --  d_v
374   --  d_w
375   --  d_x
376   --  d_y
377   --  d_z
378
379   --  d_A  Output ALI invocation tables
380   --  d_B
381   --  d_C  Diagnose all cycles
382   --  d_D
383   --  d_E
384   --  d_F
385   --  d_G
386   --  d_H
387   --  d_I  Output invocation graph
388   --  d_J
389   --  d_K
390   --  d_L  Output library graph
391   --  d_M
392   --  d_N
393   --  d_O
394   --  d_P  Output cycle paths
395   --  d_Q
396   --  d_R
397   --  d_S  Output elaboration-order status
398   --  d_T  Output elaboration-order trace information
399   --  d_U
400   --  d_V  Validate bindo cycles, graphs, and order
401   --  d_W
402   --  d_X
403   --  d_Y
404   --  d_Z
405
406   --  d_1
407   --  d_2
408   --  d_3
409   --  d_4
410   --  d_5
411   --  d_6
412   --  d_7
413   --  d_8
414   --  d_9
415
416   --  Debug flags used in package Make and its clients (e.g. GNATMAKE)
417
418   --  da
419   --  db
420   --  dc
421   --  dd
422   --  de
423   --  df  Only output file names, not path names, in log
424   --  dg
425   --  dh  Generate listing showing loading of name table hash chains
426   --  di
427   --  dj
428   --  dk
429   --  dl
430   --  dm  Display the number of maximum simultaneous compilations
431   --  dn  Do not delete temp files created by gnatmake
432   --  do
433   --  dp  Prints the contents of the Q used by Make.Compile_Sources
434   --  dq  Prints source files as they are enqueued and dequeued
435   --  dr
436   --  ds
437   --  dt  Display time stamps when there is a mismatch
438   --  du  List units as their ali files are acquired
439   --  dv
440   --  dw  Prints the list of units withed by the unit currently explored
441   --  dx
442   --  dy
443   --  dz
444
445   --------------------------------------------
446   -- Documentation for Compiler Debug Flags --
447   --------------------------------------------
448
449   --  da   Generate messages tracking semantic analyzer progress. A message
450   --       is output showing each node as it gets analyzed, expanded,
451   --       resolved, or evaluated. This option is useful for finding out
452   --       exactly where a bomb during semantic analysis is occurring.
453
454   --  db   In Exp_Dbug, certain type names are encoded to include debugging
455   --       information. This debug switch causes lines to be output showing
456   --       the encodings used.
457
458   --  dc   List names of units as they are compiled. One line of output will
459   --       be generated at the start of compiling each unit (package or
460   --       subprogram).
461
462   --  dd   Dynamic allocation of tables messages generated. Each time a
463   --       table is reallocated, a line is output indicating the expansion.
464
465   --  de   List the entity table
466
467   --  df   Full tree/source print (includes withed units). Normally the tree
468   --       output (dt) or recreated source output (dg,do,ds) includes only
469   --       the main unit. If df is set, then the output in either case
470   --       includes all compiled units (see also dg,do,ds,dt). Note that to
471   --       be effective, this switch must be used in combination with one or
472   --       more of dt, dg, do or ds.
473
474   --  dg   Print the source recreated from the generated tree. In the case
475   --       where the tree has been rewritten this output includes only the
476   --       generated code, not the original code (see also df,do,ds,dz).
477   --       This flag differs from -gnatG in that the output also includes
478   --       non-source generated null statements, and freeze nodes, which
479   --       are normally omitted in -gnatG mode.
480
481   --  dh   Generates a table at the end of a compilation showing how the hash
482   --       table chains built by the Namet package are loaded. This is useful
483   --       in ensuring that the hashing algorithm (in Namet.Hash) is working
484   --       effectively with typical sets of program identifiers.
485
486   --  di   Generate messages for visibility linking/delinking
487
488   --  dj   Suppress "junk null check" for access parameters. This flag permits
489   --       Ada programs to pass null parameters to access parameters, and to
490   --       explicitly check such access values against the null literal.
491   --       Neither of these is valid Ada, but both were allowed in versions of
492   --       GNAT before 3.10, so this switch can ease the transition process.
493
494   --  dk   Immediate kill on abort. Normally on an abort (i.e. a call to
495   --       Comperr.Compiler_Abort), the GNATBUG message is not given if
496   --       there is a previous error. This debug switch bypasses this test
497   --       and gives the message unconditionally (useful for debugging).
498
499   --  dl   Generate unit load trace messages. A line of traceback output is
500   --       generated each time a request is made to the library manager to
501   --       load a new unit.
502
503   --  dm   Prevent special frontend inlining in GNATprove mode. In some cases,
504   --       some subprogram calls are inlined in GNATprove mode in order to
505   --       facilitate formal verification. This debug switch prevents that
506   --       inlining to happen.
507
508   --  dn   Generate messages for node/list allocation. Each time a node or
509   --       list header is allocated, a line of output is generated. Certain
510   --       other basic tree operations also cause a line of output to be
511   --       generated. This option is useful in seeing where the parser is
512   --       blowing up.
513
514   --  do   Print the source recreated from the generated tree. In the case
515   --       where the tree has been rewritten, this output includes only the
516   --       original code, not the generated code (see also df,dg,ds,dz).
517
518   --  dp   Generate messages for parser scope stack push/pops. A line of
519   --       output by the parser each time the parser scope stack is either
520   --       pushed or popped. Useful in debugging situations where the
521   --       parser scope stack ends up incorrectly synchronized
522
523   --  dq   In layout version 1.38, 2002/01/12, a circuit was implemented
524   --       to give decent default alignment to short records that had no
525   --       specific alignment set. This debug option restores the previous
526   --       behavior of giving such records poor alignments, typically 1.
527   --       This may be useful in dealing with transition.
528
529   --  dr   Generate parser resynchronization messages. Normally the parser
530   --       resynchronizes quietly. With this debug option, two messages
531   --       are generated, one when the parser starts a resynchronization
532   --       skip, and another when it resumes parsing. Useful in debugging
533   --       inadequate error recovery situations.
534
535   --  ds   Print the source recreated from the generated tree. In the case
536   --       where the tree has been rewritten this output includes both the
537   --       generated code and the original code with the generated code
538   --       being enlosed in curly brackets (see also df,do,ds,dz)
539
540   --  dt   Print full tree. The generated tree is output (see also df,dy)
541
542   --  du   Uncheck categorization pragmas. This debug switch causes the
543   --       elaboration control pragmas (Pure, Preelaborate, etc.) and the
544   --       categorization pragmas (Shared_Passive, Remote_Types, etc.) to be
545   --       ignored, so that normal checks are not made (this is particularly
546   --       useful for adding temporary debugging code to units that have
547   --       pragmas that are inconsistent with the debugging code added).
548
549   --  dv   Output trace of overload resolution. Outputs messages for
550   --       overload attempts that involve cascaded errors, or where
551   --       an interpretation is incompatible with the context.
552
553   --  dw   Write semantic scope stack messages. Each time a scope is created
554   --       or removed, a message is output (see the Sem_Ch8.Push_Scope and
555   --       Sem_Ch8.Pop_Scope subprograms).
556
557   --  dx   Force expansion on, even if no code being generated. Normally the
558   --       expander is inhibited if no code is generated. This switch forces
559   --       expansion to proceed normally even if the backend is not being
560   --       called. This is particularly useful for debugging purposes when
561   --       using the front-end only version of the compiler (which normally
562   --       would never do any expansion).
563
564   --  dy   Print tree of package Standard. Normally the tree print out does
565   --       not include package Standard, even if the -df switch is set. This
566   --       switch forces output of the internal tree built for Standard.
567
568   --  dz   Print source of package Standard. Normally the source print out
569   --       does not include package Standard, even if the -df switch is set.
570   --       This switch forces output of the source recreated from the internal
571   --       tree built for Standard. Note that this differs from -gnatS in
572   --       that it prints from the actual tree using the normal Sprint
573   --       circuitry for printing trees.
574
575   --  dA   Forces output of representation information, including full
576   --       information for all internal type and object entities, as well
577   --       as all user defined type and object entities including private
578   --       and incomplete types. This debug switch also automatically sets
579   --       the equivalent of -gnatRm.
580
581   --  dB   Output debug encodings for types and variants. See Exp_Dbug for
582   --       exact form of the generated output.
583
584   --  dC   Output trace information showing the decisions made during
585   --       check suppression activity in unit Checks.
586
587   --  dD   Delete new elaboration checks. This flag causes GNAT to return
588   --       to the 3.13a elaboration semantics, and to suppress the fixing
589   --       of two bugs. The first is in the context of inner routines in
590   --       dynamic elaboration mode, when the subprogram we are in was
591   --       called at elaboration time by a unit that was also compiled with
592   --       dynamic elaboration checks. In this case, if A calls B calls C,
593   --       and all are in different units, we need an elaboration check at
594   --       each call. These nested checks were only put in recently (see
595   --       version 1.80 of Sem_Elab) and we provide this debug flag to
596   --       revert to the previous behavior in case of regressions. The
597   --       other behavior reverted by this flag is the treatment of the
598   --       Elaborate_Body pragma in static elaboration mode. This used to
599   --       be treated as not needing elaboration checking, but in fact in
600   --       general Elaborate_All is still required because of nested calls.
601
602   --  dE   Apply compile time elaboration checking for with relations between
603   --       predefined units. Normally no checks are made.
604
605   --  dF   Disable the new SPARK checking rules for pointer aliasing. This is
606   --       only activated as part of GNATprove mode and on SPARK code. Now
607   --       that pointer support is part of the official SPARK language, this
608   --       switch allows reverting to the previous version of GNATprove
609   --       rejecting pointers.
610
611   --  dG   Generate all warnings. Normally Errout suppresses warnings on
612   --       units that are not part of the main extended source, and also
613   --       suppresses warnings on instantiations in the main extended
614   --       source that duplicate warnings already posted on the template.
615   --       This switch stops both kinds of deletion and causes Errout to
616   --       post all warnings sent to it.
617
618   --  dH   Inhibit call to gigi. This is useful for testing front end data
619   --       layout, and may be useful in other debugging situations where
620   --       you do not want gigi to intefere with the testing.
621
622   --  dI   Inhibit internal name numbering in gnatDG listing. Any sequence of
623   --       the form <uppercase-letter><digits><lowercase-letter> appearing in
624   --       a name is replaced by <uppercase-letter>...<lowercase-letter>. This
625   --       is used in the fixed bugs run to minimize system and version
626   --       dependency in filed -gnatD or -gnatG output.
627
628   --  dJ   Prepend the name of the enclosing subprogram in compiler messages
629   --       (errors, warnings, style checks). This is useful in particular to
630   --       integrate compiler warnings in static analysis tools such as
631   --       CodePeer.
632
633   --  dK   Kill all error messages. This debug flag suppresses the output
634   --       of all error messages. It is used in regression tests where the
635   --       error messages are target dependent and irrelevant.
636
637   --  dL   The compiler ignores calls in instances and invoke subprograms
638   --       which are external to the instance for both the static and dynamic
639   --       elaboration models.
640
641   --  dM   Assume all variables have been modified, and ignore current value
642   --       indications. This debug flag disconnects the tracking of constant
643   --       values (see Exp_Ch2.Expand_Current_Value).
644
645   --  dN   Do not generate file name information in exception messages
646
647   --  dO   Output immediate error messages. This causes error messages to
648   --       be output as soon as they are generated (disconnecting several
649   --       circuits for improvement of messages, deletion of duplicate
650   --       messages etc). Useful to diagnose compiler bombs caused by
651   --       erroneous handling of error situations
652
653   --  dP   Do not check for controlled objects in preelaborable packages.
654   --       RM 10.2.1(9) forbids the use of library level controlled objects
655   --       in preelaborable packages, but this restriction is a huge pain,
656   --       especially in the predefined library units.
657
658   --  dQ   Use old method for determining what goes on the secondary stack.
659   --       This disables some newer optimizations. The intent is to use this
660   --       temporarily to measure before/after efficiency. ???Remove this
661   --       when we are done (see Sem_Util.Requires_Transient_Scope).
662
663   --  dR   Bypass the check for a proper version of s-rpc being present
664   --       to use the -gnatz? switch. This allows debugging of the use
665   --       of stubs generation without needing to have GLADE (or some
666   --       other PCS  installed).
667
668   --  dS   Omit conversion of fpt numbers to exact machine numbers in
669   --       non-static evaluation contexts (see Check_Non_Static_Context).
670   --       This is intended for testing out timing problems with this
671   --       conversion circuit.
672
673   --  dT   Similar to dS, but omits the conversions only in the case where
674   --       the parent is not a constant declaration.
675
676   --  dU   Enable garbage collection of unreachable entities. This enables
677   --       both the reachability analysis and changing the Is_Public and
678   --       Is_Eliminated flags.
679
680   --  dV   Enable viewing of all symbols in debugger. Causes debug information
681   --       to be generated for all symbols, including internal symbols. This
682   --       is enabled by default for -gnatD, but this switch allows this to
683   --       be enabled without generating modified source files. Note that the
684   --       use of -gnatdV ensures in the dwarf/elf case that all symbols that
685   --       are present in the elf tables are also in the dwarf tables (which
686   --       seems to be required by some tools). Another effect of dV is to
687   --       generate full qualified names, including internal names generated
688   --       for blocks and loops.
689
690   --  dW   Disable warnings when a possibly uninitialized scalar value is
691   --       passed to an IN OUT parameter of a procedure. This usage is a
692   --       quite improper bounded error [erroneous in Ada 83] situation,
693   --       and would normally generate a warning. However, to ease the
694   --       task of transitioning incorrect legacy code, we provide this
695   --       undocumented feature for suppressing these warnings.
696
697   --  dY   Enable configurable run-time mode, just as though the System file
698   --       had Configurable_Run_Time_Mode set to True. This is useful in
699   --       testing high integrity mode.
700
701   --  dZ   Generate listing showing the contents of the dispatch tables. Each
702   --       line has an internally generated number used for references between
703   --       tagged types and primitives. For each primitive the output has the
704   --       following fields:
705   --
706   --         - Letter 'P' or letter 's': The former indicates that this
707   --           primitive will be located in a primary dispatch table. The
708   --           latter indicates that it will be located in a secondary
709   --           dispatch table.
710   --
711   --         - Name of the primitive. In case of predefined Ada primitives
712   --           the text "(predefined)" is added before the name, and these
713   --           acronyms are used: SR (Stream_Read), SW (Stream_Write), SI
714   --           (Stream_Input), SO (Stream_Output), DA (Deep_Adjust), DF
715   --           (Deep_Finalize). In addition Oeq identifies the equality
716   --           operator, and "_assign" the assignment.
717   --
718   --         - If the primitive covers interface types, two extra fields
719   --           referencing other primitives are generated: "Alias" references
720   --           the primitive of the tagged type that covers an interface
721   --           primitive, and "AI_Alias" references the covered interface
722   --           primitive.
723   --
724   --         - The expression "at #xx" indicates the slot of the dispatch
725   --           table occupied by such primitive in its corresponding primary
726   --           or secondary dispatch table.
727   --
728   --         - In case of abstract subprograms the text "is abstract" is
729   --           added at the end of the line.
730
731   --  d.a  Force Target_Strict_Alignment to True, even on targets where it
732   --       would normally be false. Can be used for testing strict alignment
733   --       circuitry in the compiler.
734
735   --  d.b  Dump back end types. During Create_Standard, the back end is
736   --       queried for all available types. This option shows them.
737
738   --  d.c  Generate inline concatenation, instead of calling one of the
739   --       System.Concat_n.Str_Concat_n routines in cases where the latter
740   --       routines would normally be called.
741
742   --  d.d  Disable atomic synchronization for all atomic variable references.
743   --       Pragma Enable_Atomic_Synchronization is ignored.
744
745   --  d.e  Enable atomic synchronization for all atomic variable references.
746   --       Pragma Disable_Atomic_Synchronization is ignored, and also the
747   --       compiler switch -gnated is ignored.
748
749   --  d.f  Suppress folding of static expressions. This of course results
750   --       in seriously non-conforming behavior, but is useful sometimes
751   --       when tracking down handling of complex expressions.
752
753   --  d.g  Enables conversion of a raise statement into a goto when the
754   --       relevant handler is statically determinable. For now we only try
755   --       this if this debug flag is set. Later we will enable this more
756   --       generally by default.
757
758   --  d.h  Minimize the creation of public internal symbols for concatenation
759   --       by enforcing a secondary stack-like handling of the final result.
760   --       The target of the concatenation is thus constrained in place and
761   --       initialized with the result instead of acting as its alias.
762
763   --  d.i  Ignore all occurrences of pragma Warnings in the sources. This can
764   --       be used in particular to disable Warnings (Off) to check if any of
765   --       these statements are inappropriate.
766
767   --  d.k  If an error message contains a reference to a location in an
768   --       internal unit, then suppress the line number in this reference.
769
770   --  d.j  Generate listing of frontend inlined calls and inline calls passed
771   --       to the backend. This is useful to locate skipped calls that must be
772   --       inlined by the frontend.
773
774   --  d.l  Use Ada 95 semantics for limited function returns. This may be
775   --       used to work around the incompatibility introduced by AI-318-2.
776   --       It is useful only in Ada 2005 and later.
777
778   --  d.m  When -gnatl is used, the normal output includes full listings of
779   --       all files in the extended main source (body/spec/subunits). If this
780   --       debug switch is used, then the full listing is given only for the
781   --       main source (this corresponds to a previous behavior of -gnatl and
782   --       is used for running the ACATS tests).
783
784   --  d.n  Print source file names as they are loaded. This is useful if the
785   --       compiler has a bug -- these are the files that need to be included
786   --       in a bug report.
787
788   --  d.o  Conservative elaboration order for indirect calls. This causes
789   --       P'Access to be treated as a call in more cases.
790
791   --  d.p  In Ada 95 (or 83) mode, use original Ada 95 behavior for the
792   --       interpretation of component clauses crossing byte boundaries when
793   --       using the non-default bit order (i.e. ignore AI95-0133).
794
795   --  d.q  If an array variable or constant is not modified in Ada code, and
796   --       is passed to an 'in' parameter of a foreign-convention subprogram,
797   --       and that subprogram modifies the array, the Ada compiler normally
798   --       assumes that the array is not modified. This option suppresses such
799   --       optimizations. This option should not be used; the correct solution
800   --       is to declare the parameter 'in out'.
801
802   --  d.r  Do not reorder components in record types.
803
804   --  d.s  The compiler no longer attempts to optimize the calls to secondary
805   --       stack management routines SS_Mark and SS_Release. As a result, each
806   --       transient block tasked with secondary stack management will fulfill
807   --       its role unconditionally.
808
809   --  d.s  The compiler does not generate calls to secondary stack management
810   --       routines SS_Mark and SS_Release for a transient block when there is
811   --       an enclosing scoping construct which already manages the secondary
812   --       stack.
813
814   --  d.t  The compiler has been modified (a fairly extensive modification)
815   --       to generate static dispatch tables for library level tagged types.
816   --       This debug switch disables this modification and reverts to the
817   --       previous dynamic construction of tables. It is there as a possible
818   --       work around if we run into trouble with the new implementation.
819
820   --  d.u  Sets Modify_Tree_For_C mode in which tree is modified to make it
821   --       easier to generate code using a C compiler.
822
823   --  d.v  This flag enforces the elaboration rules defined in the SPARK
824   --       Reference Manual, chapter 7.7, to all SPARK code within a unit. As
825   --       a result, constructs which violate the rules in chapter 7.7 are no
826   --       longer accepted, even if the implementation is able to statically
827   --       ensure that accepting these constructs does not introduce the
828   --       possibility of failing an elaboration check.
829
830   --  d.w  This flag turns off the scanning of loops to detect possible
831   --       infinite loops.
832
833   --  d.x  No exception handlers in generated code. This causes exception
834   --       handlers to be eliminated from the generated code. They are still
835   --       fully compiled and analyzed, they just get eliminated from the
836   --       code generation step.
837
838   --  d.y  Disable implicit pragma Elaborate_All on task bodies. When a task
839   --       body calls a procedure in the same package, and that procedure
840   --       calls a procedure in another package, the static elaboration
841   --       machinery adds an implicit Elaborate_All on the other package. This
842   --       switch disables the addition of the implicit pragma in such cases.
843
844   --  d.z  Restore previous front-end support for Inline_Always. In default
845   --       mode, for targets that use the GCC back end, Inline_Always is
846   --       handled by the back end. Use of this switch restores the previous
847   --       handling of Inline_Always by the front end on such targets. For the
848   --       targets that do not use the GCC back end, this switch is ignored.
849
850   --  d.A  There seems to be a problem with ASIS if we activate the circuit
851   --       for reading and writing the aspect specification hash table, so
852   --       for now, this is controlled by the debug flag d.A. The hash table
853   --       is only written and read if this flag is set.
854
855   --  d.B  Generate a bug box when we see an abort_statement, even though
856   --       there is no bug. Useful for testing Comperr.Compiler_Abort: write
857   --       some code containing an abort_statement, and compile it with
858   --       -gnatd.B. There is nothing special about abort_statements; it just
859   --       provides a way to control where the bug box is generated. See "when
860   --       N_Abort_Statement" in package body Expander.
861
862   --  d.C  Generate call to System.Concat_n.Str_Concat_n routines in cases
863   --       where we would normally generate inline concatenation code.
864
865   --  d.D  For compatibility with some Ada 95 compilers implementing only
866   --       one feature of Ada 2005 (overriding keyword), disable errors on use
867   --       of overriding keyword in Ada 95 mode.
868
869   --  d.E  Turn selected errors into warnings. This debug switch causes a
870   --       specific set of error messages into warnings. Setting this switch
871   --       causes Opt.Error_To_Warning to be set to True. The intention is
872   --       that this be used for messages representing upwards incompatible
873   --       changes to Ada 2012 that cause previously correct programs to be
874   --       treated as illegal now. The following cases are affected:
875   --
876   --          Errors relating to overlapping subprogram parameters for cases
877   --          other than IN OUT parameters to functions.
878   --
879   --          Errors relating to the new rules about not defining equality
880   --          too late so that composition of equality can be assured.
881   --
882   --          Errors relating to overriding indicators on protected subprogram
883   --          bodies (not an Ada 2012 incompatibility, but might cause errors
884   --          for existing programs assuming they were legal because GNAT
885   --          formerly allowed them).
886
887   --  d.F  Sets GNATprove_Mode to True. This allows debugging the frontend in
888   --       the special mode used by GNATprove.
889
890   --  d.G  Previously the compiler ignored calls via generic formal parameters
891   --       when doing the analysis for the static elaboration model. This is
892   --       now fixed, but we provide this debug flag to revert to the previous
893   --       situation of ignoring such calls to aid in transition.
894
895   --  d.H  Sets ASIS_GNSA_Mode to True. This signals the front end to suppress
896   --       the call to gigi in ASIS_Mode.
897
898   --  d.I  Do not ignore enum representation clauses in CodePeer mode.
899   --       The default of ignoring representation clauses for enumeration
900   --       types in CodePeer is good for the majority of Ada code, but in some
901   --       cases being able to change this default might be useful to remove
902   --       some false positives.
903
904   --  d.J  Relaxed rules for pragma No_Return. A pragma No_Return is illegal
905   --       if it applies to a body. This switch disables the legality check
906   --       for that. If the procedure does in fact return normally, execution
907   --       is erroneous, and therefore unpredictable.
908
909   --  d.L  Normally the front end generates special expansion for conditional
910   --       expressions of a limited type. This debug flag removes this special
911   --       case expansion, leaving it up to the back end to handle conditional
912   --       expressions correctly.
913
914   --  d.M  Relaxed RM semantics. This flag sets Opt.Relaxed_RM_Semantics
915   --       See Opt.Relaxed_RM_Semantics for more details.
916
917   --  d.N  Enlarge entities by one node (but don't attempt to use this extra
918   --       node for storage of any flags or fields). This can be used to do
919   --       experiments on the impact of increasing entity sizes.
920
921   --  d.O  Dump internal SCO tables. Before outputting the SCO information to
922   --       the ALI file, the internal SCO tables (SCO_Table/SCO_Unit_Table)
923   --       are dumped for debugging purposes.
924
925   --  d.P  Previous non-optimized handling of length comparisons. Setting this
926   --       flag inhibits the effect of Optimize_Length_Comparison in Exp_Ch4.
927   --       This is there in case we find a situation where the optimization
928   --       malfunctions, to provide a work around.
929
930   --  d.Q  Previous incomplete style checks for binary operators. Style checks
931   --       for token separation rules were incomplete and have been made
932   --       compliant with the documentation. For example, no warning was
933   --       issued for expressions such as 16-One or "A"&"B". Setting this flag
934   --       inhibits these new checks.
935
936   --  d.R  As documented in lib-writ.ads, restrictions in the ali file can
937   --       have two forms, positional and named. The named notation is the
938   --       current preferred form, but the use of this debug switch will force
939   --       the use of the obsolescent positional form.
940
941   --  d.S  Force Optimize_Alignment (Space) mode as the default
942
943   --  d.T  Force Optimize_Alignment (Time) mode as the default
944
945   --  d.U  Ignore indirect calls for static elaboration. The static
946   --       elaboration model is conservative, especially regarding indirect
947   --       calls. If you say Proc'Access, it will assume you might call
948   --       Proc. This can cause elaboration cycles at bind time. This flag
949   --       reverts to the behavior of earlier compilers, which ignored
950   --       indirect calls.
951
952   --  d.V  Do not verify the validity of SCIL files (CodePeer mode). When
953   --       generating SCIL files for CodePeer, by default we verify that the
954   --       SCIL is well formed before saving it on disk. This switch can be
955   --       used to disable this checking, either to improve speed or to shut
956   --       down a false positive detected during the verification.
957
958   --  d.W  Print out debugging information for Walk_Library_Items, including
959   --       the order in which units are walked. This is primarily for use in
960   --       debugging CodePeer mode.
961
962   --  d.X  A previous version of GNAT allowed indexing aspects to be redefined
963   --       on derived container types, while the default iterator was
964   --       inherited from the parent type. This nonstandard extension is
965   --       preserved temporarily for use by the modeling project under debug
966   --       flag d.X.
967
968   --  d.Z  Normally we always enable expansion in configurable run-time mode
969   --       to make sure we get error messages about unsupported features even
970   --       when compiling in -gnatc mode. But expansion is turned off in this
971   --       case if debug flag -gnatd.Z is used. This is to deal with the case
972   --       where we discover difficulties in this new processing.
973
974   --  d_a  The compiler stops the examination of a task body once it reaches
975   --       an accept or select statement for the static elaboration model. The
976   --       behavior is similar to that of No_Entry_Calls_In_Elaboration_Code,
977   --       but does not penalize actual entry calls in elaboration code.
978
979   --  d_e  The compiler ignores simple entry calls, asynchronous transfer of
980   --       control, conditional entry calls, timed entry calls, and requeue
981   --       statements in both the static and dynamic elaboration models.
982
983   --  d_f  Issue info messages related to GNATprove usage to help users
984   --       understand analysis results. By default these are not issued as
985   --       beginners find them confusing. Set automatically by GNATprove when
986   --       switch --info is used.
987
988   --  d_i  The compiler ignores calls and task activations when they target a
989   --       subprogram or task type defined in an external instance for both
990   --       the static and dynamic elaboration models.
991
992   --  d_j  The compiler reads JSON files that would be generated by the same
993   --       compilation session if -gnatRjs was passed, in order to populate
994   --       the internal tables of the Repinfo unit from them.
995
996   --  d_p  The compiler ignores calls to subprograms which verify the run-time
997   --       semantics of invariants and postconditions in both the static and
998   --       dynamic elaboration models.
999
1000   --  d_s  The compiler stops the examination of a task body once it reaches
1001   --       a call to routine Ada.Synchronous_Task_Control.Suspend_Until_True
1002   --       or Ada.Synchronous_Barriers.Wait_For_Release.
1003
1004   --  d_A  Do not generate ALI files by setting Opt.Disable_ALI_File.
1005
1006   --  d_F  The compiler encodes the full path from an invocation construct to
1007   --       an external target, offering additional information to GNATBIND for
1008   --       purposes of error diagnostics.
1009
1010   --  d_K  (Reserved) Enable reporting a warning on known-problem issues of
1011   --       previous releases. No action performed in the wavefront.
1012
1013   --  d_L  Output trace information on elaboration checking. This debug switch
1014   --       causes output to be generated showing each call or instantiation as
1015   --       it is checked, and the progress of the recursive trace through
1016   --       elaboration calls at compile time.
1017
1018   --  d_T  The compiler outputs trance information to standard output whenever
1019   --       an invocation path is recorded.
1020
1021   --  d1   Error messages have node numbers where possible. Normally error
1022   --       messages have only source locations. This option is useful when
1023   --       debugging errors caused by expanded code, where the source location
1024   --       does not give enough information.
1025
1026   --  d2   Suppress output of the error position flags for verbose form error
1027   --       messages. The messages are still interspersed in the listing, but
1028   --       without any error flags or extra blank lines. Also causes an extra
1029   --       <<< to be output at the right margin. This is intended to be the
1030   --       easiest format for checking conformance of ACATS B tests. This
1031   --       flag also suppresses the additional messages explaining why a
1032   --       non-static expression is non-static (see Sem_Eval.Why_Not_Static).
1033   --       This avoids having to worry about these messages in ACATS testing.
1034
1035   --  d3   Causes Comperr to dump the contents of the node for which an abort
1036   --       was detected (normally only the Node_Id of the node is output).
1037
1038   --  d4   Inhibits automatic krunching of predefined library unit file names.
1039   --       Normally, as described in the spec of package Krunch, such files
1040   --       are automatically krunched to 8 characters, with special treatment
1041   --       of the prefixes Ada, System, and Interfaces. Setting this debug
1042   --       switch disables this special treatment.
1043
1044   --  d5   Causes the tree read/write circuit to output detailed information
1045   --       tracking the data that is read and written element by element.
1046
1047   --  d6   Normally access-to-unconstrained-array types are represented
1048   --       using fat (double) pointers. Using this debug flag causes them
1049   --       to default to thin. This can be used to test the performance
1050   --       implications of using thin pointers, and also to test that the
1051   --       compiler functions correctly with this choice.
1052
1053   --  d7   Normally a -gnatl or -gnatv listing includes the time stamp of the
1054   --       source file and the time of the compilation. This debug flag can
1055   --       be used to suppress this output, and also suppresses the message
1056   --       with the version of the compiler. This is useful for regression
1057   --       tests which need to have consistent output.
1058
1059   --  d8   This forces the packed stuff to generate code assuming the
1060   --       opposite endianness from the actual correct value. Useful in
1061   --       testing out code generation from the packed routines.
1062
1063   --  d9   This allows lock free implementation for protected objects
1064   --       (see Exp_Ch9).
1065
1066   --  d.1  Sets Opt.Unnest_Subprogram_Mode to enable unnesting of subprograms.
1067   --       This special pass does not actually unnest things, but it ensures
1068   --       that a nested procedure does not contain any uplevel references.
1069   --       See spec of Exp_Unst for full details.
1070
1071   --  d.2  Allow statements within declarative parts. This is not usually
1072   --       allowed, but in some debugging contexts (e.g. testing the circuit
1073   --       for unnesting of procedures), it is useful to allow this.
1074
1075   --  d.3  Output debugging information from Exp_Unst, including the name of
1076   --       any unreachable subprograms that get deleted.
1077
1078   --  d.4  By default in case of an error during C generation, the .c or .h
1079   --       file is deleted. This flag keeps the C file.
1080
1081   --  d.5  By default a subprogram imported generates a subprogram profile.
1082   --       This debug flag disables this generation when generating C code,
1083   --       assuming a proper #include will be used instead.
1084
1085   --  d.6  By default the C back-end avoids declaring types that are not
1086   --       referenced by the generated C code. This debug flag restores the
1087   --       output of all the types.
1088
1089   --  d.7  Indicates (to gnat2scil) that CodePeer is being invoked as a
1090   --       prover by the SPARK tools and that therefore gnat2scil should
1091   --       avoid SCIL generation strategies which can introduce soundness
1092   --       issues (e.g., assuming that a low bound of an array parameter
1093   --       of an unconstrained subtype belongs to the index subtype).
1094
1095   --  d.9  Enable build-in-place for function calls returning some nonlimited
1096   --       types.
1097
1098   ------------------------------------------
1099   -- Documentation for Binder Debug Flags --
1100   ------------------------------------------
1101
1102   --  da  Normally if there is an elaboration circularity, then in describing
1103   --      the cycle, links involving internal units are omitted, since they
1104   --      are irrelevant and confusing. This debug flag causes all links to
1105   --      be listed, and is useful when diagnosing circularities introduced
1106   --      by incorrect changes to the run-time library itself.
1107
1108   --  db  Output debug information from Better_Choice in Binde, which uses
1109   --      various heuristics to determine elaboration order in cases where
1110   --      multiple orders are valid.
1111
1112   --  dc  List units as they are chosen. As units are selected for addition to
1113   --      the elaboration order, a line of output is generated showing which
1114   --      unit has been selected.
1115
1116   --  de  Similar to the effect of -e (output complete list of elaboration
1117   --      dependencies) except that internal units are included in the
1118   --      listing.
1119
1120   --  di  Normally GNATBIND calls Read_Ali with Ignore_Errors set to False,
1121   --      since the binder really needs correct version ALI files to do its
1122   --      job. This debug flag causes Ignore_Errors mode to be set for the
1123   --      binder (and is particularly useful for testing ignore errors mode).
1124
1125   --  dn  List details of manipulation of Num_Pred values during execution of
1126   --      the algorithm used to determine a correct order of elaboration. This
1127   --      is useful in diagnosing any problems in its behavior.
1128
1129   --  do  Use older elaboration order preference. The new preference rules
1130   --      prefer specs with no bodies to specs with bodies, and between two
1131   --      specs with bodies, prefers the one whose body is closer to being
1132   --      able to be elaborated. This is a clear improvement, but we provide
1133   --      this debug flag in case of regressions. Note: -do is even older
1134   --      than -dp.
1135
1136   --  dp  Use old elaboration order preference. The new preference rules
1137   --      elaborate all units within a strongly connected component together,
1138   --      with no other units in between. In particular, if a spec/body pair
1139   --      can be elaborated together, it will be. In the new order, the binder
1140   --      behaves as if every pragma Elaborate_All that would be legal is
1141   --      present, even if it does not appear in the source code.
1142
1143   --  du  List unit name and file name for each unit as it is read in
1144
1145   --  dv  Verbose debugging printouts
1146
1147   --  dx  Force the binder to read (and then ignore) the xref information
1148   --      in ali files (used to check that read circuit is working OK).
1149
1150   --  d_a  GNATBIND ignores the effects of pragma Elaborate_All in the case of
1151   --       elaboration order and treats the associated dependency as a regular
1152   --       with edge.
1153
1154   --  d_b  GNATBIND ignores the effects of pragma Elaborate_Body in the case
1155   --       of elaboration order and treats the spec and body as decoupled.
1156
1157   --  d_e  GNATBIND ignores the effects of pragma Elaborate in the case of
1158   --       elaboration order and no longer creates an implicit dependency on
1159   --       the body of the argument.
1160
1161   --  d_t  GNATBIND output trace information of cycle-detection activities to
1162   --       standard output.
1163
1164   --  d_A  GNATBIND output the contents of all ALI invocation-related tables
1165   --       in textual format to standard output.
1166
1167   --  d_C  GNATBIND diagnoses all unique cycles within the bind, rather than
1168   --       just the most important one.
1169
1170   --  d_I  GNATBIND outputs the contents of the invocation graph in textual
1171   --       format to standard output.
1172
1173   --  d_L  GNATBIND outputs the contents of the library graph in textual
1174   --       format to standard output.
1175
1176   --  d_P  GNATBIND outputs the cycle paths to standard output
1177
1178   --  d_S  GNATBIND outputs trace information concerning the status of its
1179   --       various phases to standard output.
1180
1181   --  d_T  GNATBIND outputs trace information of elaboration order detection
1182   --       activities to standard output.
1183
1184   --  d_V  GNATBIND validates the invocation graph, library graph along with
1185   --       its cycles, and the elaboration order.
1186
1187   --------------------------------------------
1188   -- Documentation for gnatmake Debug Flags --
1189   --------------------------------------------
1190
1191   --  df  Only output file names, not path names, in log
1192
1193   --  dh  Generate listing showing loading of name table hash chains,
1194   --      same as for the compiler.
1195
1196   --  dm  Issue a message indicating the maximum number of simultaneous
1197   --      compilations.
1198
1199   --  dn  Do not delete temporary files created by gnatmake at the end
1200   --      of execution, such as temporary config pragma files, mapping
1201   --      files or project path files. This debug switch is equivalent to
1202   --      the standard switch --keep-temp-files. We retain the debug switch
1203   --      for back compatibility with past usage.
1204
1205   --  dp  Prints the Q used by routine Make.Compile_Sources every time
1206   --      we go around the main compile loop of Make.Compile_Sources
1207
1208   --  dq  Prints source files as they are enqueued and dequeued in the Q
1209   --      used by routine Make.Compile_Sources. Useful to figure out the
1210   --      order in which sources are recompiled.
1211
1212   --  dt  When a time stamp mismatch has been found for an ALI file,
1213   --      display the source file name, the time stamp expected and
1214   --      the time stamp found.
1215
1216   --  du  List unit name and file name for each unit as it is read in
1217
1218   --  dw  Prints the list of units withed by the unit currently explored
1219   --      during the main loop of Make.Compile_Sources.
1220
1221   ---------------------------------------------
1222   -- Documentation for gprbuild Debug Flags  --
1223   ---------------------------------------------
1224
1225   --  dm  Display the maximum number of simultaneous compilations.
1226
1227   --  dn  Do not delete temporary files created by gprbuild at the end
1228   --      of execution, such as temporary config pragma files, mapping
1229   --      files or project path files. This debug switch is equivalent to
1230   --      the standard switch --keep-temp-files. We retain the debug switch
1231   --      for back compatibility with past usage.
1232
1233   --  dt  When a time stamp mismatch has been found for an ALI file,
1234   --      display the source file name, the time stamp expected and
1235   --      the time stamp found.
1236
1237   --------------------
1238   -- Set_Debug_Flag --
1239   --------------------
1240
1241   procedure Set_Debug_Flag (C : Character; Val : Boolean := True) is
1242      subtype Dig  is Character range '1' .. '9';
1243      subtype LLet is Character range 'a' .. 'z';
1244      subtype ULet is Character range 'A' .. 'Z';
1245
1246   begin
1247      if C in Dig then
1248         case Dig (C) is
1249            when '1' =>
1250               Debug_Flag_1 := Val;
1251            when '2' =>
1252               Debug_Flag_2 := Val;
1253            when '3' =>
1254               Debug_Flag_3 := Val;
1255            when '4' =>
1256               Debug_Flag_4 := Val;
1257            when '5' =>
1258               Debug_Flag_5 := Val;
1259            when '6' =>
1260               Debug_Flag_6 := Val;
1261            when '7' =>
1262               Debug_Flag_7 := Val;
1263            when '8' =>
1264               Debug_Flag_8 := Val;
1265            when '9' =>
1266               Debug_Flag_9 := Val;
1267         end case;
1268
1269      elsif C in ULet then
1270         case ULet (C) is
1271            when 'A' =>
1272               Debug_Flag_AA := Val;
1273            when 'B' =>
1274               Debug_Flag_BB := Val;
1275            when 'C' =>
1276               Debug_Flag_CC := Val;
1277            when 'D' =>
1278               Debug_Flag_DD := Val;
1279            when 'E' =>
1280               Debug_Flag_EE := Val;
1281            when 'F' =>
1282               Debug_Flag_FF := Val;
1283            when 'G' =>
1284               Debug_Flag_GG := Val;
1285            when 'H' =>
1286               Debug_Flag_HH := Val;
1287            when 'I' =>
1288               Debug_Flag_II := Val;
1289            when 'J' =>
1290               Debug_Flag_JJ := Val;
1291            when 'K' =>
1292               Debug_Flag_KK := Val;
1293            when 'L' =>
1294               Debug_Flag_LL := Val;
1295            when 'M' =>
1296               Debug_Flag_MM := Val;
1297            when 'N' =>
1298               Debug_Flag_NN := Val;
1299            when 'O' =>
1300               Debug_Flag_OO := Val;
1301            when 'P' =>
1302               Debug_Flag_PP := Val;
1303            when 'Q' =>
1304               Debug_Flag_QQ := Val;
1305            when 'R' =>
1306               Debug_Flag_RR := Val;
1307            when 'S' =>
1308               Debug_Flag_SS := Val;
1309            when 'T' =>
1310               Debug_Flag_TT := Val;
1311            when 'U' =>
1312               Debug_Flag_UU := Val;
1313            when 'V' =>
1314               Debug_Flag_VV := Val;
1315            when 'W' =>
1316               Debug_Flag_WW := Val;
1317            when 'X' =>
1318               Debug_Flag_XX := Val;
1319            when 'Y' =>
1320               Debug_Flag_YY := Val;
1321            when 'Z' =>
1322               Debug_Flag_ZZ := Val;
1323         end case;
1324
1325      else
1326         case LLet (C) is
1327            when 'a' =>
1328               Debug_Flag_A := Val;
1329            when 'b' =>
1330               Debug_Flag_B := Val;
1331            when 'c' =>
1332               Debug_Flag_C := Val;
1333            when 'd' =>
1334               Debug_Flag_D := Val;
1335            when 'e' =>
1336               Debug_Flag_E := Val;
1337            when 'f' =>
1338               Debug_Flag_F := Val;
1339            when 'g' =>
1340               Debug_Flag_G := Val;
1341            when 'h' =>
1342               Debug_Flag_H := Val;
1343            when 'i' =>
1344               Debug_Flag_I := Val;
1345            when 'j' =>
1346               Debug_Flag_J := Val;
1347            when 'k' =>
1348               Debug_Flag_K := Val;
1349            when 'l' =>
1350               Debug_Flag_L := Val;
1351            when 'm' =>
1352               Debug_Flag_M := Val;
1353            when 'n' =>
1354               Debug_Flag_N := Val;
1355            when 'o' =>
1356               Debug_Flag_O := Val;
1357            when 'p' =>
1358               Debug_Flag_P := Val;
1359            when 'q' =>
1360               Debug_Flag_Q := Val;
1361            when 'r' =>
1362               Debug_Flag_R := Val;
1363            when 's' =>
1364               Debug_Flag_S := Val;
1365            when 't' =>
1366               Debug_Flag_T := Val;
1367            when 'u' =>
1368               Debug_Flag_U := Val;
1369            when 'v' =>
1370               Debug_Flag_V := Val;
1371            when 'w' =>
1372               Debug_Flag_W := Val;
1373            when 'x' =>
1374               Debug_Flag_X := Val;
1375            when 'y' =>
1376               Debug_Flag_Y := Val;
1377            when 'z' =>
1378               Debug_Flag_Z := Val;
1379         end case;
1380      end if;
1381   end Set_Debug_Flag;
1382
1383   ---------------------------
1384   -- Set_Dotted_Debug_Flag --
1385   ---------------------------
1386
1387   procedure Set_Dotted_Debug_Flag (C : Character; Val : Boolean := True) is
1388      subtype Dig  is Character range '1' .. '9';
1389      subtype LLet is Character range 'a' .. 'z';
1390      subtype ULet is Character range 'A' .. 'Z';
1391
1392   begin
1393      if C in Dig then
1394         case Dig (C) is
1395            when '1' =>
1396               Debug_Flag_Dot_1 := Val;
1397            when '2' =>
1398               Debug_Flag_Dot_2 := Val;
1399            when '3' =>
1400               Debug_Flag_Dot_3 := Val;
1401            when '4' =>
1402               Debug_Flag_Dot_4 := Val;
1403            when '5' =>
1404               Debug_Flag_Dot_5 := Val;
1405            when '6' =>
1406               Debug_Flag_Dot_6 := Val;
1407            when '7' =>
1408               Debug_Flag_Dot_7 := Val;
1409            when '8' =>
1410               Debug_Flag_Dot_8 := Val;
1411            when '9' =>
1412               Debug_Flag_Dot_9 := Val;
1413         end case;
1414
1415      elsif C in ULet then
1416         case ULet (C) is
1417            when 'A' =>
1418               Debug_Flag_Dot_AA := Val;
1419            when 'B' =>
1420               Debug_Flag_Dot_BB := Val;
1421            when 'C' =>
1422               Debug_Flag_Dot_CC := Val;
1423            when 'D' =>
1424               Debug_Flag_Dot_DD := Val;
1425            when 'E' =>
1426               Debug_Flag_Dot_EE := Val;
1427            when 'F' =>
1428               Debug_Flag_Dot_FF := Val;
1429            when 'G' =>
1430               Debug_Flag_Dot_GG := Val;
1431            when 'H' =>
1432               Debug_Flag_Dot_HH := Val;
1433            when 'I' =>
1434               Debug_Flag_Dot_II := Val;
1435            when 'J' =>
1436               Debug_Flag_Dot_JJ := Val;
1437            when 'K' =>
1438               Debug_Flag_Dot_KK := Val;
1439            when 'L' =>
1440               Debug_Flag_Dot_LL := Val;
1441            when 'M' =>
1442               Debug_Flag_Dot_MM := Val;
1443            when 'N' =>
1444               Debug_Flag_Dot_NN := Val;
1445            when 'O' =>
1446               Debug_Flag_Dot_OO := Val;
1447            when 'P' =>
1448               Debug_Flag_Dot_PP := Val;
1449            when 'Q' =>
1450               Debug_Flag_Dot_QQ := Val;
1451            when 'R' =>
1452               Debug_Flag_Dot_RR := Val;
1453            when 'S' =>
1454               Debug_Flag_Dot_SS := Val;
1455            when 'T' =>
1456               Debug_Flag_Dot_TT := Val;
1457            when 'U' =>
1458               Debug_Flag_Dot_UU := Val;
1459            when 'V' =>
1460               Debug_Flag_Dot_VV := Val;
1461            when 'W' =>
1462               Debug_Flag_Dot_WW := Val;
1463            when 'X' =>
1464               Debug_Flag_Dot_XX := Val;
1465            when 'Y' =>
1466               Debug_Flag_Dot_YY := Val;
1467            when 'Z' =>
1468               Debug_Flag_Dot_ZZ := Val;
1469         end case;
1470
1471      else
1472         case LLet (C) is
1473            when 'a' =>
1474               Debug_Flag_Dot_A := Val;
1475            when 'b' =>
1476               Debug_Flag_Dot_B := Val;
1477            when 'c' =>
1478               Debug_Flag_Dot_C := Val;
1479            when 'd' =>
1480               Debug_Flag_Dot_D := Val;
1481            when 'e' =>
1482               Debug_Flag_Dot_E := Val;
1483            when 'f' =>
1484               Debug_Flag_Dot_F := Val;
1485            when 'g' =>
1486               Debug_Flag_Dot_G := Val;
1487            when 'h' =>
1488               Debug_Flag_Dot_H := Val;
1489            when 'i' =>
1490               Debug_Flag_Dot_I := Val;
1491            when 'j' =>
1492               Debug_Flag_Dot_J := Val;
1493            when 'k' =>
1494               Debug_Flag_Dot_K := Val;
1495            when 'l' =>
1496               Debug_Flag_Dot_L := Val;
1497            when 'm' =>
1498               Debug_Flag_Dot_M := Val;
1499            when 'n' =>
1500               Debug_Flag_Dot_N := Val;
1501            when 'o' =>
1502               Debug_Flag_Dot_O := Val;
1503            when 'p' =>
1504               Debug_Flag_Dot_P := Val;
1505            when 'q' =>
1506               Debug_Flag_Dot_Q := Val;
1507            when 'r' =>
1508               Debug_Flag_Dot_R := Val;
1509            when 's' =>
1510               Debug_Flag_Dot_S := Val;
1511            when 't' =>
1512               Debug_Flag_Dot_T := Val;
1513            when 'u' =>
1514               Debug_Flag_Dot_U := Val;
1515            when 'v' =>
1516               Debug_Flag_Dot_V := Val;
1517            when 'w' =>
1518               Debug_Flag_Dot_W := Val;
1519            when 'x' =>
1520               Debug_Flag_Dot_X := Val;
1521            when 'y' =>
1522               Debug_Flag_Dot_Y := Val;
1523            when 'z' =>
1524               Debug_Flag_Dot_Z := Val;
1525         end case;
1526      end if;
1527   end Set_Dotted_Debug_Flag;
1528
1529   --------------------------------
1530   -- Set_Underscored_Debug_Flag --
1531   --------------------------------
1532
1533   procedure Set_Underscored_Debug_Flag
1534     (C   : Character;
1535      Val : Boolean := True)
1536   is
1537      subtype Dig  is Character range '1' .. '9';
1538      subtype LLet is Character range 'a' .. 'z';
1539      subtype ULet is Character range 'A' .. 'Z';
1540
1541   begin
1542      if C in Dig then
1543         case Dig (C) is
1544            when '1' =>
1545               Debug_Flag_Underscore_1 := Val;
1546            when '2' =>
1547               Debug_Flag_Underscore_2 := Val;
1548            when '3' =>
1549               Debug_Flag_Underscore_3 := Val;
1550            when '4' =>
1551               Debug_Flag_Underscore_4 := Val;
1552            when '5' =>
1553               Debug_Flag_Underscore_5 := Val;
1554            when '6' =>
1555               Debug_Flag_Underscore_6 := Val;
1556            when '7' =>
1557               Debug_Flag_Underscore_7 := Val;
1558            when '8' =>
1559               Debug_Flag_Underscore_8 := Val;
1560            when '9' =>
1561               Debug_Flag_Underscore_9 := Val;
1562         end case;
1563
1564      elsif C in ULet then
1565         case ULet (C) is
1566            when 'A' =>
1567               Debug_Flag_Underscore_AA := Val;
1568            when 'B' =>
1569               Debug_Flag_Underscore_BB := Val;
1570            when 'C' =>
1571               Debug_Flag_Underscore_CC := Val;
1572            when 'D' =>
1573               Debug_Flag_Underscore_DD := Val;
1574            when 'E' =>
1575               Debug_Flag_Underscore_EE := Val;
1576            when 'F' =>
1577               Debug_Flag_Underscore_FF := Val;
1578            when 'G' =>
1579               Debug_Flag_Underscore_GG := Val;
1580            when 'H' =>
1581               Debug_Flag_Underscore_HH := Val;
1582            when 'I' =>
1583               Debug_Flag_Underscore_II := Val;
1584            when 'J' =>
1585               Debug_Flag_Underscore_JJ := Val;
1586            when 'K' =>
1587               Debug_Flag_Underscore_KK := Val;
1588            when 'L' =>
1589               Debug_Flag_Underscore_LL := Val;
1590            when 'M' =>
1591               Debug_Flag_Underscore_MM := Val;
1592            when 'N' =>
1593               Debug_Flag_Underscore_NN := Val;
1594            when 'O' =>
1595               Debug_Flag_Underscore_OO := Val;
1596            when 'P' =>
1597               Debug_Flag_Underscore_PP := Val;
1598            when 'Q' =>
1599               Debug_Flag_Underscore_QQ := Val;
1600            when 'R' =>
1601               Debug_Flag_Underscore_RR := Val;
1602            when 'S' =>
1603               Debug_Flag_Underscore_SS := Val;
1604            when 'T' =>
1605               Debug_Flag_Underscore_TT := Val;
1606            when 'U' =>
1607               Debug_Flag_Underscore_UU := Val;
1608            when 'V' =>
1609               Debug_Flag_Underscore_VV := Val;
1610            when 'W' =>
1611               Debug_Flag_Underscore_WW := Val;
1612            when 'X' =>
1613               Debug_Flag_Underscore_XX := Val;
1614            when 'Y' =>
1615               Debug_Flag_Underscore_YY := Val;
1616            when 'Z' =>
1617               Debug_Flag_Underscore_ZZ := Val;
1618         end case;
1619
1620      else
1621         case LLet (C) is
1622            when 'a' =>
1623               Debug_Flag_Underscore_A := Val;
1624            when 'b' =>
1625               Debug_Flag_Underscore_B := Val;
1626            when 'c' =>
1627               Debug_Flag_Underscore_C := Val;
1628            when 'd' =>
1629               Debug_Flag_Underscore_D := Val;
1630            when 'e' =>
1631               Debug_Flag_Underscore_E := Val;
1632            when 'f' =>
1633               Debug_Flag_Underscore_F := Val;
1634            when 'g' =>
1635               Debug_Flag_Underscore_G := Val;
1636            when 'h' =>
1637               Debug_Flag_Underscore_H := Val;
1638            when 'i' =>
1639               Debug_Flag_Underscore_I := Val;
1640            when 'j' =>
1641               Debug_Flag_Underscore_J := Val;
1642            when 'k' =>
1643               Debug_Flag_Underscore_K := Val;
1644            when 'l' =>
1645               Debug_Flag_Underscore_L := Val;
1646            when 'm' =>
1647               Debug_Flag_Underscore_M := Val;
1648            when 'n' =>
1649               Debug_Flag_Underscore_N := Val;
1650            when 'o' =>
1651               Debug_Flag_Underscore_O := Val;
1652            when 'p' =>
1653               Debug_Flag_Underscore_P := Val;
1654            when 'q' =>
1655               Debug_Flag_Underscore_Q := Val;
1656            when 'r' =>
1657               Debug_Flag_Underscore_R := Val;
1658            when 's' =>
1659               Debug_Flag_Underscore_S := Val;
1660            when 't' =>
1661               Debug_Flag_Underscore_T := Val;
1662            when 'u' =>
1663               Debug_Flag_Underscore_U := Val;
1664            when 'v' =>
1665               Debug_Flag_Underscore_V := Val;
1666            when 'w' =>
1667               Debug_Flag_Underscore_W := Val;
1668            when 'x' =>
1669               Debug_Flag_Underscore_X := Val;
1670            when 'y' =>
1671               Debug_Flag_Underscore_Y := Val;
1672            when 'z' =>
1673               Debug_Flag_Underscore_Z := Val;
1674         end case;
1675      end if;
1676   end Set_Underscored_Debug_Flag;
1677
1678end Debug;
1679