| 1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
| 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-2011, 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 |
|
|
------------------------------------------------------------------------------
|
| 25 |
|
|
|
| 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.
|
| 31 |
|
|
|
| 32 |
|
|
pragma Warnings (Off);
|
| 33 |
|
|
-- This package is used also by gnatcoll
|
| 34 |
|
|
with System.OS_Lib; use System.OS_Lib;
|
| 35 |
|
|
pragma Warnings (On);
|
| 36 |
|
|
|
| 37 |
|
|
with Prj.Tree;
|
| 38 |
|
|
|
| 39 |
|
|
package Switch.M is
|
| 40 |
|
|
|
| 41 |
|
|
procedure Scan_Make_Switches
|
| 42 |
|
|
(Env : in out Prj.Tree.Environment;
|
| 43 |
|
|
Switch_Chars : String;
|
| 44 |
|
|
Success : out Boolean);
|
| 45 |
|
|
-- Scan a gnatmake switch and act accordingly. For switches that are
|
| 46 |
|
|
-- recognized, Success is set to True. A switch that is not recognized and
|
| 47 |
|
|
-- consists of one small letter causes a fatal error exit and control does
|
| 48 |
|
|
-- not return. For all other not recognized switches, Success is set to
|
| 49 |
|
|
-- False, so that the switch may be passed to the compiler.
|
| 50 |
|
|
--
|
| 51 |
|
|
-- Project_Node_Tree is used to store tree-specific parameters like the
|
| 52 |
|
|
-- project path.
|
| 53 |
|
|
|
| 54 |
|
|
procedure Normalize_Compiler_Switches
|
| 55 |
|
|
(Switch_Chars : String;
|
| 56 |
|
|
Switches : in out Argument_List_Access;
|
| 57 |
|
|
Last : out Natural);
|
| 58 |
|
|
-- Takes a compiler switch which potentially is equivalent to more
|
| 59 |
|
|
-- that one simple switches and returns the equivalent list of simple
|
| 60 |
|
|
-- switches that are stored in an ALI file. Switches will be extended
|
| 61 |
|
|
-- if initially null or too short. Last indicates the index in Switches
|
| 62 |
|
|
-- of the last simple switch. Last is equal to zero, if it has been
|
| 63 |
|
|
-- determined that Switch_Chars is ill-formed or does not contain any
|
| 64 |
|
|
-- switch that should be stored in an ALI file. Otherwise, the list of
|
| 65 |
|
|
-- simple switches is Switches (Switches'First .. Last).
|
| 66 |
|
|
--
|
| 67 |
|
|
-- Example: if Switch_Chars is equal to "-gnatAwue", then the list of
|
| 68 |
|
|
-- simple switches will have 3 components: -gnatA, -gnatwu, -gnatwe.
|
| 69 |
|
|
--
|
| 70 |
|
|
-- The String_Access components of Switches should not be deallocated:
|
| 71 |
|
|
-- they are shallow copies of components in a table in the body.
|
| 72 |
|
|
|
| 73 |
|
|
function Normalize_Compiler_Switches
|
| 74 |
|
|
(Switch_Chars : String) return Argument_List;
|
| 75 |
|
|
-- Similar to the previous procedure. The return value is the list of
|
| 76 |
|
|
-- simple switches. It may be an empty array if it has been determined
|
| 77 |
|
|
-- that Switch_Chars is ill-formed or does not contain any switch that
|
| 78 |
|
|
-- should be stored in an ALI file. The String_Access components of the
|
| 79 |
|
|
-- returned value should not be deallocated.
|
| 80 |
|
|
|
| 81 |
|
|
end Switch.M;
|