* rtl.h (rtunion_def): Constify member `rtstr'.
[official-gcc.git] / gcc / fixinc / genfixes
blobae67610af5cb3c35727e5f8b654398b9d7df42dc
1 #! /bin/sh
3 # Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4 # This file is part of GNU CC.
6 # GNU CC is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # GNU CC is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU CC; see the file COPYING. If not, write to
18 # the Free Software Foundation, 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
21 SHELL=/bin/sh
22 export SHELL
23 if [ $# -eq 0 ] ; then
24 not_done=false
25 else
26 not_done=true
29 while $not_done
31 case "$1" in
32 -D )
33 shift
34 if [ $# -eq 0 ] ; then
35 not_done=false
36 else
37 AG="$AG -D$1"
38 shift
42 -D* )
43 AG="$AG $1"
44 shift
47 '-?' )
48 echo "USAGE: gendefs [ -D<def-name> ... ] [ <output-name> ]"
49 echo "WHERE: '<def-name>' specifies a #define test name from inclhack.def"
50 echo " and '<output-name>' is one of:"
51 echo " inclhack.sh fixincl.x fixincl.sh machine.h"
52 echo "The default is to produce the first three outputs."
53 exit 0
56 * )
57 not_done=false
59 esac
60 done
62 if [ $# -eq 0 ] ; then
63 ${SHELL} $0 $AG inclhack.sh || exit 1
64 ${SHELL} $0 $AG fixincl.x || exit 1
65 ${SHELL} $0 $AG fixincl.sh || exit 1
66 exit 0
69 AG="autogen $AG"
70 set -e
72 case "$1" in
73 inclhack.sh )
74 if (autogen --help > /dev/null 2>&1)
75 then
76 echo AutoGen-ing inclhack.sh
77 $AG inclhack.def
78 else
79 echo "AutoGen does not appear to be correctly installed."
80 echo "Please download and install:"
81 echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz"
82 touch inclhack.sh
86 fixincl.x )
87 if (autogen --help > /dev/null 2>&1)
88 then
89 echo AutoGen-ing fixincl.x
90 $AG -T fixincl.tpl -b fixincl inclhack.def
91 else
92 echo "AutoGen does not appear to be correctly installed."
93 echo "Please download and install:"
94 echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz"
95 touch fixincl.x
99 fixincl.sh )
100 if (autogen --help > /dev/null 2>&1)
101 then
102 echo AutoGen-ing fixincl.sh
103 $AG -DPROGRAM=1 -b fixincl inclhack.def
104 else
105 echo "AutoGen does not appear to be correctly installed."
106 echo "Please download and install:"
107 echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz"
108 touch fixincl.sh
112 machname.h )
113 # This script extracts from the specs file all the predefined macros
114 # that are not in the C89 reserved namespace (the reserved namespace
115 # is all identifiers beginnning with two underscores or one underscore
116 # followed by a capital letter). The specs file is on standard input.
117 # A #define for a regular expression to find any of those macros in a
118 # header file is written to standard output.
120 # Note dependency on ASCII. \040 = space, \011 = tab, \012 = newline.
121 # tr ' ' '\n' is, alas, not portable.
123 tr -s '\040\011' '\012\012' < ../specs |
124 sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$/\1/p' |
125 sort -u > mn.T
127 if grep -v '^_[_A-Z]' mn.T > mn.U
128 then
129 echo "Forbidden identifiers: `tr '\012' ' ' <mn.U`" >&2
130 sed 's/^/\\\\</; s/$/\\\\>/' <mn.U | tr '\012' '|' > mn.V
131 echo '' >>mn.V
132 sed 's/^/#define MN_NAME_PAT "/; s/|$/"/' < mn.V > machname.T
133 else
134 echo "No forbidden identifiers defined by this target" >&2
135 echo '#undef MN_NAME_PAT' > machname.T
137 rm -f mn.[TUV]
138 mv -f machname.T machname.h
142 echo genfixes cannot create $1
143 exit 1
145 esac
147 exit 0