summaryrefslogtreecommitdiff
path: root/gcc/fixinc/genfixes
diff options
context:
space:
mode:
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-04 21:42:00 +0000
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-04 21:42:00 +0000
commitcde396adc1149db3b9f67946fb53bc63136cf419 (patch)
tree8f81e15524ec14490e37b27653b87e0a00573278 /gcc/fixinc/genfixes
parent38cc6f0cb8e049d79a2d5f902c3220560747b744 (diff)
downloadgcc-cde396adc1149db3b9f67946fb53bc63136cf419.tar.gz
2000-02-04 Bruce Korb <bkorb@gnu.org>
* fixinc/genfixes(machname.h): Move the functionality from gen-machine.h into this file. UNdef MN_NAME_PAT if there are no names to change. Also, be a little kinder when AutoGen is not present. * fixinc/Makefile.in(machname.h): Change the generation rule to use genfixes. * fixinc/fixfixes.c(machine_name): machine_name_fix's functionality now dependent upon whether MN_NAME_PAT is defined. * fixinc/fixtests.c(machine_name): ditto. * fixinc/fixlib.c(mn_get_regexps): conditional on definition of MN_NAME_PAT. * fixinc/fixlib.h(mn_get_regexps): ditto * fixinc/gen-machine.h: DELETED git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixinc/genfixes')
-rwxr-xr-xgcc/fixinc/genfixes106
1 files changed, 83 insertions, 23 deletions
diff --git a/gcc/fixinc/genfixes b/gcc/fixinc/genfixes
index dbee8918f56..ae67610af5c 100755
--- a/gcc/fixinc/genfixes
+++ b/gcc/fixinc/genfixes
@@ -1,15 +1,25 @@
#! /bin/sh
-if (autogen --help > /dev/null 2>&1) ; then : ; else
- echo "AutoGen does not appear to be correctly installed."
- echo "Please download and install:"
- echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz"
- exit 1
-fi
+# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+# This file is part of GNU CC.
+
+# GNU CC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# GNU CC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU CC; see the file COPYING. If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
SHELL=/bin/sh
export SHELL
-AG="autogen"
if [ $# -eq 0 ] ; then
not_done=false
else
@@ -37,8 +47,9 @@ do
'-?' )
echo "USAGE: gendefs [ -D<def-name> ... ] [ <output-name> ]"
echo "WHERE: '<def-name>' specifies a #define test name from inclhack.def"
- echo " and '<output-name>' is one of: inclhack.sh fixincl.x fixincl.sh"
- echo "The default is to produce all three outputs."
+ echo " and '<output-name>' is one of:"
+ echo " inclhack.sh fixincl.x fixincl.sh machine.h"
+ echo "The default is to produce the first three outputs."
exit 0
;;
@@ -49,33 +60,82 @@ do
done
if [ $# -eq 0 ] ; then
- echo AutoGen-ing inclhack.sh
- $AG inclhack.def
-
- echo AutoGen-ing fixincl.x
- $AG -T fixincl.tpl -b fixincl inclhack.def
-
- echo AutoGen-ing fixincl.sh
- $AG -DPROGRAM=1 -b fixincl inclhack.def
+ ${SHELL} $0 $AG inclhack.sh || exit 1
+ ${SHELL} $0 $AG fixincl.x || exit 1
+ ${SHELL} $0 $AG fixincl.sh || exit 1
exit 0
fi
+AG="autogen $AG"
set -e
case "$1" in
inclhack.sh )
- echo AutoGen-ing inclhack.sh
- $AG inclhack.def
+ if (autogen --help > /dev/null 2>&1)
+ then
+ echo AutoGen-ing inclhack.sh
+ $AG inclhack.def
+ else
+ echo "AutoGen does not appear to be correctly installed."
+ echo "Please download and install:"
+ echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz"
+ touch inclhack.sh
+ fi
;;
fixincl.x )
- echo AutoGen-ing fixincl.x
- $AG -T fixincl.tpl -b fixincl inclhack.def
+ if (autogen --help > /dev/null 2>&1)
+ then
+ echo AutoGen-ing fixincl.x
+ $AG -T fixincl.tpl -b fixincl inclhack.def
+ else
+ echo "AutoGen does not appear to be correctly installed."
+ echo "Please download and install:"
+ echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz"
+ touch fixincl.x
+ fi
;;
fixincl.sh )
- echo AutoGen-ing fixincl.sh
- $AG -DPROGRAM=1 -b fixincl inclhack.def
+ if (autogen --help > /dev/null 2>&1)
+ then
+ echo AutoGen-ing fixincl.sh
+ $AG -DPROGRAM=1 -b fixincl inclhack.def
+ else
+ echo "AutoGen does not appear to be correctly installed."
+ echo "Please download and install:"
+ echo " ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz"
+ touch fixincl.sh
+ fi
+ ;;
+
+machname.h )
+ # This script extracts from the specs file all the predefined macros
+ # that are not in the C89 reserved namespace (the reserved namespace
+ # is all identifiers beginnning with two underscores or one underscore
+ # followed by a capital letter). The specs file is on standard input.
+ # A #define for a regular expression to find any of those macros in a
+ # header file is written to standard output.
+
+ # Note dependency on ASCII. \040 = space, \011 = tab, \012 = newline.
+ # tr ' ' '\n' is, alas, not portable.
+
+ tr -s '\040\011' '\012\012' < ../specs |
+ sed -n 's/^.*-D\([a-zA-Z_][a-zA-Z0-9_]*\).*$/\1/p' |
+ sort -u > mn.T
+
+ if grep -v '^_[_A-Z]' mn.T > mn.U
+ then
+ echo "Forbidden identifiers: `tr '\012' ' ' <mn.U`" >&2
+ sed 's/^/\\\\</; s/$/\\\\>/' <mn.U | tr '\012' '|' > mn.V
+ echo '' >>mn.V
+ sed 's/^/#define MN_NAME_PAT "/; s/|$/"/' < mn.V > machname.T
+ else
+ echo "No forbidden identifiers defined by this target" >&2
+ echo '#undef MN_NAME_PAT' > machname.T
+ fi
+ rm -f mn.[TUV]
+ mv -f machname.T machname.h
;;
* )