fixing pr42337
[official-gcc.git] / gcc / ada / switch-m.ads
blob6a800234083fbda2fc347a5ca74d653bbd79d290
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S W I T C H - M --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2009, 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. 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. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
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 with System.OS_Lib; use System.OS_Lib;
33 with Prj.Tree;
35 package Switch.M is
37 procedure Scan_Make_Switches
38 (Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
39 Switch_Chars : String;
40 Success : out Boolean);
41 -- Scan a gnatmake switch and act accordingly. For switches that are
42 -- recognized, Success is set to True. A switch that is not recognized and
43 -- consists of one small letter causes a fatal error exit and control does
44 -- not return. For all other not recognized switches, Success is set to
45 -- False, so that the switch may be passed to the compiler.
47 -- Project_Node_Tree is used to store tree-specific parameters like the
48 -- project path.
50 procedure Normalize_Compiler_Switches
51 (Switch_Chars : String;
52 Switches : in out Argument_List_Access;
53 Last : out Natural);
54 -- Takes a compiler switch which potentially is equivalent to more
55 -- that one simple switches and returns the equivalent list of simple
56 -- switches that are stored in an ALI file. Switches will be extended
57 -- if initially null or too short. Last indicates the index in Switches
58 -- of the last simple switch. Last is equal to zero, if it has been
59 -- determined that Switch_Chars is ill-formed or does not contain any
60 -- switch that should be stored in an ALI file. Otherwise, the list of
61 -- simple switches is Switches (Switches'First .. Last).
63 -- Example: if Switch_Chars is equal to "-gnatAwue", then the list of
64 -- simple switches will have 3 components: -gnatA, -gnatwu, -gnatwe.
66 -- The String_Access components of Switches should not be deallocated:
67 -- they are shallow copies of components in a table in the body.
69 function Normalize_Compiler_Switches
70 (Switch_Chars : String) return Argument_List;
71 -- Similar to the previous procedure. The return value is the list of
72 -- simple switches. It may be an empty array if it has been determined
73 -- that Switch_Chars is ill-formed or does not contain any switch that
74 -- should be stored in an ALI file. The String_Access components of the
75 -- returned value should not be deallocated.
77 end Switch.M;