Remove some compile time warnings about duplicate definitions.
[official-gcc.git] / gcc / ada / gnatprep.ads
blob7e8fbd82e7b4d029a3345aa5c68975172fc66a92
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G N A T P R E P --
6 -- --
7 -- S p e c --
8 -- --
9 -- $Revision: 1.12 $ --
10 -- --
11 -- Copyright (C) 1992-1998, Free Software Foundation, Inc. --
12 -- --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 -- --
27 ------------------------------------------------------------------------------
29 -- This program provides a simple preprocessing capability for Ada programs.
30 -- It is designed for use with GNAT, but is not dependent on any special
31 -- features of GNAT.
33 -- To call gnatprep use
35 -- gnatprep infile outfile [deffile] [-c] [-b] [-r] [-s] [-u]
36 -- [-Dsymbol=value]
38 -- where
40 -- infile is the full name of the input file, which is an Ada source
41 -- file containing preprocessor directives.
43 -- outfile is the full name of the output file, which is an Ada source
44 -- in standard Ada form. When used with GNAT, this file name will
45 -- normally have an ads or adb suffix.
47 -- deffile is the full name of a text file containing definitions of
48 -- symbols to be referenced by the preprocessor. This argument is optional
50 -- The -c switch, causes both preprocessor lines and the lines deleted
51 -- by preprocessing to be retained in the output source as comments marked
52 -- with the special string "--! ". This option will result in line numbers
53 -- being preserved in the output file.
55 -- The -b switch causes both preprocessor lines and the lines deleted by
56 -- preprocessing to be replaced by blank lines in the output source file,
57 -- thus preserving line numbers in the output file.
59 -- The -r switch causes a Source_Reference pragma to be generated that
60 -- references the original input file, so that error messages will use
61 -- the file name of this original file.
63 -- The -u switch causes gnatprep to treat any undefined symbol that it
64 -- encounters as having the value False. Otherwise an undefined symbol
65 -- is a fatal error.
67 -- The -s switch causes a sorted list of symbol names and values to be
68 -- listed on the standard output file.
70 -- The -D switch causes symbol 'symbol' to be associated with 'value'.
71 -- This symbols can then be referenced by the preprocessor
73 -- Note: if neither -b nor -c is present, then preprocessor lines and
74 -- deleted lines are completely removed from the output, unless -r is
75 -- specified, in which case -b is assumed.
77 -- The definitions file contains lines of the form
79 -- symbol := value
81 -- where symbol is an identifier, following normal Ada (case-insensitive)
82 -- rules for its syntax, and value is one of the following:
84 -- Empty, corresponding to a null substitution
86 -- A string literal using normal Ada syntax
88 -- Any sequence of characters from the set
89 -- (letters, digits, period, underline)
91 -- Comment lines may also appear in the definitions file, starting with
92 -- the usual --, and comments may be added to the definitions lines.
94 -- The input text may contain preprocessor conditional inclusion lines,
95 -- and also general symbol substitution sequences.
97 -- The preprocessor conditional inclusion commands have the form
99 -- #if <expression> [then]
100 -- lines
101 -- #elsif <expression> [then]
102 -- lines
103 -- #elsif <expression> [then]
104 -- lines
105 -- ...
106 -- #else
107 -- lines
108 -- #end if;
110 -- Where expression is defined by the following grammar :
111 -- expression ::= <symbol>
112 -- expression ::= <symbol> = "<value>"
113 -- expression ::= <symbol> = <symbol>
114 -- expression ::= <symbol> 'Defined
115 -- expression ::= not <expression>
116 -- expression ::= <expression> and <expression>
117 -- expression ::= <expression> or <expression>
118 -- expression ::= <expression> and then <expression>
119 -- expression ::= <expression> or else <expression>
120 -- expression ::= ( <expression> )
122 -- For these Boolean tests, the symbol must have either the value True or
123 -- False. If the value is True, then the corresponding lines are included,
124 -- and if the value is False, they are excluded. It is an error to
125 -- reference a symbol not defined in the symbol definitions file, or
126 -- to reference a symbol that has a value other than True or False.
128 -- The use of the not operator inverts the sense of this logical test, so
129 -- that the lines are included only if the symbol is not defined.
131 -- The THEN keyword is optional as shown
133 -- Spaces or tabs may appear between the # and the keyword. The keywords
134 -- and the symbols are case insensitive as in normal Ada code. Comments
135 -- may be used on a preprocessor line, but other than that, no other
136 -- tokens may appear on a preprocessor line.
138 -- Any number of #elsif clauses can be present, including none at all.
140 -- The #else is optional, as in Ada.
142 -- The # marking the start of a preprocessor line must be the first
143 -- non-blank character on the line, i.e. it must be preceded only by
144 -- spaces or horizontal tabs.
146 -- Symbol substitution is obtained by using the sequence
148 -- $symbol
150 -- anywhere within a source line, except in a comment. The identifier
151 -- following the $ must match one of the symbols defined in the symbol
152 -- definition file, and the result is to substitute the value of the
153 -- symbol in place of $symbol in the output file.
155 procedure GNATprep;