1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                              I N D E P S W                               --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 2004-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.                                     --
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
32--  GNATLINK platform-independent switches
33
34--  Used to convert GNAT switches to their platform-dependent switch
35--  equivalent for the underlying linker.
36
37with System.OS_Lib; use System.OS_Lib;
38
39package Indepsw is
40
41   type Switch_Kind is
42   --  Independent switches currently supported
43
44     (Map_File);
45      --  Produce a map file. The path name of the map file to produce
46      --  is given as an argument.
47
48   procedure Convert
49     (Switch   : Switch_Kind;
50      Argument : String;
51      To       : out String_List_Access);
52   --  Convert Switch to the platform-dependent linker switch (with or without
53   --  additional arguments) To. Issue a warning if Switch is not supported
54   --  for the platform; in this case, To is set to null.
55
56   function Is_Supported (Switch : Switch_Kind) return Boolean;
57   --  Return True for each independent switch supported by the platform
58
59private
60   --  Default warning messages when the switches are not supported by the
61   --  implementation. These are in the spec so that the platform specific
62   --  bodies do not need to redefine them.
63
64   Map_File_Not_Supported : aliased String :=
65     "the underlying linker does not allow the output of a map file";
66
67   No_Support_For : constant array (Switch_Kind) of String_Access :=
68                      (Map_File => Map_File_Not_Supported'Access);
69   --  All implementations of procedure Convert should include a case
70   --  statements with a "when others =>" choice that output the default
71   --  warning message:
72
73   --   case Switch is
74   --      when ... =>
75   --         ...
76   --      when others =>
77   --         Write_Str ("warning: ");
78   --         Write_Line (No_Support_For (Switch).all);
79   --         To := null;
80   --   end case;
81
82end Indepsw;
83