genfixes (machname.h): Move the functionality from gen-machine.h into this file.
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 From-SVN: r31793
This commit is contained in:
parent
1c71e60ef7
commit
bff0dc38c2
@ -1,3 +1,28 @@
|
||||
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
|
||||
|
||||
2000-02-04 Jan Hubicka <jh@suse.cz>
|
||||
Richard Henderson <rth@cygnus.com>
|
||||
|
||||
|
@ -139,5 +139,4 @@ Makefile: Makefile.in ../config.status
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
machname.h: ../specs
|
||||
$(SHELL) $(srcdir)/gen-machname.h < ../specs > machname.T
|
||||
mv -f machname.T machname.h
|
||||
$(SHELL) $(srcdir)/genfixes $@
|
||||
|
@ -560,16 +560,16 @@ FIX_PROC_HEAD( CTRL_defn_fix )
|
||||
|
||||
FIX_PROC_HEAD( machine_name_fix )
|
||||
{
|
||||
#ifndef MN_NAME_PAT
|
||||
fputs( "The target machine has no needed machine name fixes\n", stderr );
|
||||
#else
|
||||
regmatch_t match[2];
|
||||
char *line, *base, *limit, *p, *q;
|
||||
regex_t *label_re, *name_re;
|
||||
char scratch[SCRATCHSZ];
|
||||
size_t len;
|
||||
|
||||
if (mn_get_regexps (&label_re, &name_re, "machine_name_fix"))
|
||||
/* This platform doesn't need this fix. We can only get here if
|
||||
someone is running fixfixes by hand, but let's be polite. */
|
||||
goto done;
|
||||
mn_get_regexps (&label_re, &name_re, "machine_name_fix");
|
||||
|
||||
scratch[0] = '_';
|
||||
scratch[1] = '_';
|
||||
@ -647,6 +647,7 @@ FIX_PROC_HEAD( machine_name_fix )
|
||||
}
|
||||
}
|
||||
done:
|
||||
#endif
|
||||
fputs (text, stdout);
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ compile_re( pat, re, match, e1, e2 )
|
||||
Helper routine and data for the machine_name test and fix.
|
||||
machname.h is created by black magic in the Makefile. */
|
||||
|
||||
#include "machname.h"
|
||||
#ifdef MN_NAME_PAT
|
||||
|
||||
tSCC mn_label_pat[] = "^[ \t]*#[ \t]*(if|ifdef|ifndef)[ \t]+";
|
||||
static regex_t mn_label_re;
|
||||
@ -191,16 +191,12 @@ static regex_t mn_name_re;
|
||||
|
||||
static int mn_compiled = 0;
|
||||
|
||||
int
|
||||
void
|
||||
mn_get_regexps( label_re, name_re, who )
|
||||
regex_t **label_re;
|
||||
regex_t **name_re;
|
||||
tCC *who;
|
||||
{
|
||||
/* Maybe we don't need to do this fix at all? */
|
||||
if (mn_name_pat[0] == '\0')
|
||||
return 1;
|
||||
|
||||
if (! mn_compiled)
|
||||
{
|
||||
compile_re (mn_label_pat, &mn_label_re, 1, "label pattern", who);
|
||||
@ -209,5 +205,5 @@ mn_get_regexps( label_re, name_re, who )
|
||||
}
|
||||
*label_re = &mn_label_re;
|
||||
*name_re = &mn_name_re;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "system.h"
|
||||
|
||||
#include "gnu-regex.h"
|
||||
#include "machname.h"
|
||||
|
||||
#ifndef STDIN_FILENO
|
||||
# define STDIN_FILENO 0
|
||||
@ -99,6 +100,8 @@ char * load_file_data _P_(( FILE* fp ));
|
||||
t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext ));
|
||||
void compile_re _P_(( tCC* pat, regex_t* re, int match,
|
||||
tCC *e1, tCC *e2 ));
|
||||
int mn_get_regexps _P_(( regex_t** label_re, regex_t** name_re,
|
||||
#ifdef MN_NAME_PAT
|
||||
void mn_get_regexps _P_(( regex_t** label_re, regex_t** name_re,
|
||||
tCC *who ));
|
||||
#endif
|
||||
#endif /* FIXINCLUDES_FIXLIB_H */
|
||||
|
@ -271,12 +271,14 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
|
||||
|
||||
TEST_FOR_FIX_PROC_HEAD( machine_name_test )
|
||||
{
|
||||
#ifndef MN_NAME_PAT
|
||||
return SKIP_FIX;
|
||||
#else
|
||||
regex_t *label_re, *name_re;
|
||||
regmatch_t match[2];
|
||||
tCC *base, *limit;
|
||||
|
||||
if (mn_get_regexps(&label_re, &name_re, "machine_name_test"))
|
||||
return SKIP_FIX;
|
||||
mn_get_regexps(&label_re, &name_re, "machine_name_test");
|
||||
|
||||
for (base = text;
|
||||
regexec (label_re, base, 2, match, 0) == 0;
|
||||
@ -314,6 +316,7 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_test )
|
||||
/* Otherwise, keep looking... */
|
||||
}
|
||||
return SKIP_FIX;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 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.
|
||||
|
||||
# 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' |
|
||||
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
|
||||
else
|
||||
echo "No forbidden identifiers defined by this target" >&2
|
||||
echo '#define MN_NAME_PAT ""'
|
||||
fi
|
||||
rm -f mn.[TUV]
|
||||
exit 0
|
@ -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
|
||||
;;
|
||||
|
||||
* )
|
||||
|
Loading…
Reference in New Issue
Block a user