summaryrefslogtreecommitdiff
path: root/gcc/fixinc
diff options
context:
space:
mode:
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-12 07:11:20 +0000
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-12 07:11:20 +0000
commit53668ad48fb3f33c04c05d6726886c11f222fef1 (patch)
treef1f235dc6f37b7d3a9cae6ef2fcdcc529fe13aef /gcc/fixinc
parenta99a652ba4e7f7757b06772eaff78d0635f2a1e8 (diff)
downloadgcc-53668ad48fb3f33c04c05d6726886c11f222fef1.tar.gz
1. the file name lists ought to be restricted to "*.h" anyway
2. C++ files may be named .../[a-z]++/... also 3. the original egrep pattern was not finding "__MIPSEL". I am not enough of a regexp person to know why. 4. Adding copyright year and attribution to output 5. Add copyright date and attribution 6. Clarify a bunch of comments 7. Remove dead template text 8. Correct the counting of regular expressions git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26363 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixinc')
-rw-r--r--gcc/fixinc/fixincl.tpl83
-rw-r--r--gcc/fixinc/inclhack.def24
-rw-r--r--gcc/fixinc/inclhack.tpl11
3 files changed, 70 insertions, 48 deletions
diff --git a/gcc/fixinc/fixincl.tpl b/gcc/fixinc/fixincl.tpl
index 27cf116429e..d5d6b6448a7 100644
--- a/gcc/fixinc/fixincl.tpl
+++ b/gcc/fixinc/fixincl.tpl
@@ -7,13 +7,15 @@ x =]
* files which are fixed to work correctly with ANSI C and placed in a
* directory that GNU C will search.
*
- * This script contains [=_eval fix _count =] fixup scripts.
+ * This file contains [=_eval fix _count =] fixup descriptions.
*
* See README-fixinc for more information.
*
+ * inclhack copyright (c) [=_eval "date +%Y" _shell
+ =] The Free Software Foundation, Inc.
+ *
[=_eval inclhack "# * " _gpl=]
- *[=
-
+ *[=_EVAL "re_ct=0" _shell=][=
_FOR fix =]
*
@@ -52,7 +54,9 @@ tSCC* apz[=hackname _cap=]Machs[] = {[=
_IF exesel _exist=]
/*
- * content selection pattern
+ * content selection pattern - do fix if pattern found
+ * This is a special pattern that not all egrep commands
+ * are capable of coping with. We use the GNU library, tho :)
*/[=
_FOR exesel =]
tSCC z[=hackname _cap=]Select[=_eval _index=][] =
@@ -62,7 +66,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] =
_ELIF select _exist=]
/*
- * content selection pattern
+ * content selection pattern - do fix if pattern found
*/[=
_FOR select =]
tSCC z[=hackname _cap=]Select[=_eval _index=][] =
@@ -73,7 +77,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] =
_IF bypass _exist=]
/*
- * content bypass pattern
+ * content bypass pattern - skip fix if pattern found
*/[=
_FOR bypass =]
tSCC z[=hackname _cap=]Bypass[=_eval _index=][] =
@@ -84,7 +88,7 @@ tSCC z[=hackname _cap=]Bypass[=_eval _index=][] =
_IF test _exist=]
/*
- * content test pattern. A shell will deal with it later.
+ * perform the 'test' shell command - do fix on success
*/[=
_FOR test =]
tSCC z[=hackname _cap=]Test[=_eval _index=][] =
@@ -92,41 +96,61 @@ tSCC z[=hackname _cap=]Test[=_eval _index=][] =
/test =][=
_ENDIF =][=
- _IF exesel _exist select _exist bypass _exist test _exist | | |
+
+# Build the array of test descriptions for this fix: =][=
+
+ _IF exesel _exist
+ select _exist |
+ bypass _exist |
+ test _exist |
=]
#define [=hackname _up =]_TEST_CT [=
_IF exesel _exist =][=
- _eval test _count bypass _count exesel _count + + =][=
+ _eval exesel _count
+ bypass _count +
+ test _count + =][=
+ _ELSE =][=
+ _eval select _count
+ bypass _count +
+ test _count + =][=
+ _ENDIF =]
+#define [=hackname _up =]_RE_CT [=
+ _IF exesel _exist =][=
+ _eval exesel _count bypass _count
+ "#2$ct=`expr %d + %d` ; re_ct=`expr $ct + $re_ct` ; echo $ct"
+ _printf _shell =][=
_ELSE =][=
- _eval test _count bypass _count select _count + + =][=
+ _eval select _count bypass _count
+ "#2$ct=`expr %d + %d` ; re_ct=`expr $ct + $re_ct` ; echo $ct"
+ _printf _shell =][=
_ENDIF =]
tTestDesc a[=hackname _cap=]Tests[] = {[=
- _IF test _exist =][=
- _FOR test=]
- { TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
- /test =][=
- _ENDIF =][=
+ _FOR test =]
+ { TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
+ /test =][=
- _IF bypass _exist =][=
- _FOR bypass=]
- { TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
- /bypass =][=
- _ENDIF =][=
+ _FOR bypass =]
+ { TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
+ /bypass =][=
+ # IF there is an exesel, then use that (those) selection
+ expressions, instead of the regular select expressions
+ =][=
_IF exesel _exist =][=
- _FOR exesel ,=]
- { TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL }[=
+ _FOR exesel =]
+ { TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/exesel =][=
- _ELIF select _exist =][=
- _FOR select ,=]
- { TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL }[=
+ _ELSE =][=
+ _FOR select =]
+ { TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/select =][=
_ENDIF =] };[=
_ELSE =]
#define [=hackname _up=]_TEST_CT 0
+#define [=hackname _up=]_RE_CT 0
#define a[=hackname _cap=]Tests (tTestDesc*)NULL[=
_ENDIF =]
@@ -136,12 +160,8 @@ tTestDesc a[=hackname _cap=]Tests[] = {[=
const char* apz[=hackname _cap=]Patch[] = {[=
_IF sed _exist =] "sed"[=_FOR sed=],
"-e", [=sed _str=][=/sed=][=
- _ELIF replacement _exist =] "sed",
- "s@[=select[]=]@[=replacement=]@"[=
_ELIF shell _exist =] "sh", "-c",
[=shell _str=][=
- _ELSE =][=_ERROR hackname _get "Error: %s has two fixup specifications"
- _printf =][=
_ENDIF=],
(char*)NULL };
@@ -150,10 +170,9 @@ const char* apz[=hackname _cap=]Patch[] = {[=
*
* List of all fixes
*/
-#define REGEX_COUNT [=_eval fix.select _count
- fix.bypass _count + =]
+#define REGEX_COUNT [=_eval "echo $re_ct" _shell =]
#define FIX_COUNT [=_eval fix _count =]
-tFixDesc fixDescList[ [=_eval fix _count =] ] = {[=
+tFixDesc fixDescList[ FIX_COUNT ] = {[=
_FOR fix ",\n" =]
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index 83dc6d6a480..e38eb7a16eb 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -328,11 +328,13 @@ fix = {
fix = {
hackname = no_double_slash;
/*
- * Test that the file-to-fix does not look like a C++ file
+ * Test that the file-to-fix does not from a C++ directory
+ * Also, only accept double slashes that are not part of URL's
+ * and are not the end of a quoted string.
*/
- test = '-z "`echo ${file}|egrep \'(cxx/|\+\+$|\.hh$|\.H$|\.hxx$)\'`"';
- select = '//[^"*]';
- sed = '/\/\/[^"*]/' "s|//.*$||g";
+ test = '-z `echo ${file} | egrep \'(cxx|\+\+)/\' `';
+ select = '(^|[^:])//[^"*]';
+ sed = '/\(^|[^:]\)\/\/[^"*]/' "s|//.*$||g";
};
@@ -827,14 +829,12 @@ fix = {
exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]"
"("
"M32"
- "|_*("
- "MIPSE[LB]"
- "|SYSTYPE_[A-Z0-9]"
- "|[Rr][34]000"
- "|host_mips"
- "|i386"
- "|mips"
- ")($|[^a-zA-Z0-9_])"
+ "|_*MIPSE[LB]"
+ "|_*SYSTYPE_[A-Z0-9]"
+ "|_*[Rr][34]000"
+ "|_*host_mips"
+ "|_*i386"
+ "|_*mips"
"|bsd4"
"|is68k"
"|m[68]8k"
diff --git a/gcc/fixinc/inclhack.tpl b/gcc/fixinc/inclhack.tpl
index b6b634bae94..b221ee56855 100644
--- a/gcc/fixinc/inclhack.tpl
+++ b/gcc/fixinc/inclhack.tpl
@@ -15,6 +15,9 @@ sh
#
# See README-fixinc for more information.
#
+# fixincludes copyright (c) [=_eval "date +%Y" _shell
+ =] The Free Software Foundation, Inc.
+#
[=_eval fixincludes "## " _gpl=]
#
# # # # # # # # # # # # # # # # # # # # #
@@ -334,9 +337,9 @@ while [ $# != 0 ]; do
cd ${INPUT}[=
_IF PROGRAM _env ! =]
files=`if $LINKS; then
- find ${FIND_BASE}/. \( -type f -o \( -type l -exec test ! -d {} \; \) \) -print
+ find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
else
- find ${FIND_BASE}/. -type f -print
+ find ${FIND_BASE}/. -name '*.h' -type f -print
fi | \
sed -e 's;/\./;/;g' -e 's;//*;/;g' `
[=
@@ -347,9 +350,9 @@ _IF PROGRAM _env ! =]
=]
required="$required `if $LINKS; then
- find ${FIND_BASE}/. \( -type f -o -type l \) -print
+ find ${FIND_BASE}/. -name '*.h' \( -type f -o -type l \) -print
else
- find ${FIND_BASE}/. -type f -print
+ find ${FIND_BASE}/. -name '*.h' -type f -print
fi | \
sed -e 's;/\./;/;g' -e 's;//*;/;g' | \
${FIXINCL}`"[=