1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2023, Free Software Foundation, Inc. --
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. 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 -- This package scans make switches. Note that the body of Usage must be
27 -- coordinated with the switches that are recognized by this package.
28 -- The Usage package also acts as the official documentation for the
29 -- switches that are recognized. In addition, package Debug documents
30 -- the otherwise undocumented debug switches that are also recognized.
32 pragma Warnings
(Off
);
33 -- This package is used also by gnatcoll
34 with System
.OS_Lib
; use System
.OS_Lib
;
39 Subdirs
: String_Ptr
:= null;
40 -- The value after the equal sign in switch --subdirs=...
41 -- Contains the relative subdirectory.
43 procedure Scan_Make_Switches
44 (Switch_Chars
: String;
45 Success
: out Boolean);
46 -- Scan a gnatmake switch and act accordingly. For switches that are
47 -- recognized, Success is set to True. A switch that is not recognized and
48 -- consists of one small letter causes a fatal error exit and control does
49 -- not return. For all other not recognized switches, Success is set to
50 -- False, so that the switch may be passed to the compiler.
52 -- Project_Node_Tree is used to store tree-specific parameters like the
55 procedure Normalize_Compiler_Switches
56 (Switch_Chars
: String;
57 Switches
: in out Argument_List_Access
;
59 -- Takes a compiler switch which potentially is equivalent to more
60 -- that one simple switches and returns the equivalent list of simple
61 -- switches that are stored in an ALI file. Switches will be extended
62 -- if initially null or too short. Last indicates the index in Switches
63 -- of the last simple switch. Last is equal to zero, if it has been
64 -- determined that Switch_Chars is ill-formed or does not contain any
65 -- switch that should be stored in an ALI file. Otherwise, the list of
66 -- simple switches is Switches (Switches'First .. Last).
68 -- Example: if Switch_Chars is equal to "-gnatAwue", then the list of
69 -- simple switches will have 3 components: -gnatA, -gnatwu, -gnatwe.
71 -- The String_Access components of Switches should not be deallocated:
72 -- they are shallow copies of components in a table in the body.
74 function Normalize_Compiler_Switches
75 (Switch_Chars
: String) return Argument_List
;
76 -- Similar to the previous procedure. The return value is the list of
77 -- simple switches. It may be an empty array if it has been determined
78 -- that Switch_Chars is ill-formed or does not contain any switch that
79 -- should be stored in an ALI file. The String_Access components of the
80 -- returned value should not be deallocated.