Commit 7db774d2 by Bruce Korb

1. the file name lists ought to be restricted to "*.h" anyway 2. C++ files may…

1. the file name lists ought to be restricted to "*.h" anyway 2. C++ files may be named .../[a-z]++/...

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

From-SVN: r26363
parent 96043e7e
...@@ -7,13 +7,15 @@ x =] ...@@ -7,13 +7,15 @@ x =]
* files which are fixed to work correctly with ANSI C and placed in a * files which are fixed to work correctly with ANSI C and placed in a
* directory that GNU C will search. * 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. * See README-fixinc for more information.
* *
* inclhack copyright (c) [=_eval "date +%Y" _shell
=] The Free Software Foundation, Inc.
*
[=_eval inclhack "# * " _gpl=] [=_eval inclhack "# * " _gpl=]
*[= *[=_EVAL "re_ct=0" _shell=][=
_FOR fix =] _FOR fix =]
* *
...@@ -52,7 +54,9 @@ tSCC* apz[=hackname _cap=]Machs[] = {[= ...@@ -52,7 +54,9 @@ tSCC* apz[=hackname _cap=]Machs[] = {[=
_IF exesel _exist=] _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 =] _FOR exesel =]
tSCC z[=hackname _cap=]Select[=_eval _index=][] = tSCC z[=hackname _cap=]Select[=_eval _index=][] =
...@@ -62,7 +66,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] = ...@@ -62,7 +66,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] =
_ELIF select _exist=] _ELIF select _exist=]
/* /*
* content selection pattern * content selection pattern - do fix if pattern found
*/[= */[=
_FOR select =] _FOR select =]
tSCC z[=hackname _cap=]Select[=_eval _index=][] = tSCC z[=hackname _cap=]Select[=_eval _index=][] =
...@@ -73,7 +77,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] = ...@@ -73,7 +77,7 @@ tSCC z[=hackname _cap=]Select[=_eval _index=][] =
_IF bypass _exist=] _IF bypass _exist=]
/* /*
* content bypass pattern * content bypass pattern - skip fix if pattern found
*/[= */[=
_FOR bypass =] _FOR bypass =]
tSCC z[=hackname _cap=]Bypass[=_eval _index=][] = tSCC z[=hackname _cap=]Bypass[=_eval _index=][] =
...@@ -84,7 +88,7 @@ tSCC z[=hackname _cap=]Bypass[=_eval _index=][] = ...@@ -84,7 +88,7 @@ tSCC z[=hackname _cap=]Bypass[=_eval _index=][] =
_IF test _exist=] _IF test _exist=]
/* /*
* content test pattern. A shell will deal with it later. * perform the 'test' shell command - do fix on success
*/[= */[=
_FOR test =] _FOR test =]
tSCC z[=hackname _cap=]Test[=_eval _index=][] = tSCC z[=hackname _cap=]Test[=_eval _index=][] =
...@@ -92,41 +96,61 @@ tSCC z[=hackname _cap=]Test[=_eval _index=][] = ...@@ -92,41 +96,61 @@ tSCC z[=hackname _cap=]Test[=_eval _index=][] =
/test =][= /test =][=
_ENDIF =][= _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 [= #define [=hackname _up =]_TEST_CT [=
_IF exesel _exist =][= _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 =][= _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 =] _ENDIF =]
tTestDesc a[=hackname _cap=]Tests[] = {[= tTestDesc a[=hackname _cap=]Tests[] = {[=
_IF test _exist =][= _FOR test =]
_FOR test=] { TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
{ TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[= /test =][=
/test =][=
_ENDIF =][=
_IF bypass _exist =][= _FOR bypass =]
_FOR bypass=] { TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[=
{ TT_NEGREP, z[=hackname _cap=]Bypass[=_eval _index=], (regex_t*)NULL },[= /bypass =][=
/bypass =][=
_ENDIF =][=
# IF there is an exesel, then use that (those) selection
expressions, instead of the regular select expressions
=][=
_IF exesel _exist =][= _IF exesel _exist =][=
_FOR exesel ,=] _FOR exesel =]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL }[= { TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/exesel =][= /exesel =][=
_ELIF select _exist =][= _ELSE =][=
_FOR select ,=] _FOR select =]
{ TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL }[= { TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[=
/select =][= /select =][=
_ENDIF =] };[= _ENDIF =] };[=
_ELSE =] _ELSE =]
#define [=hackname _up=]_TEST_CT 0 #define [=hackname _up=]_TEST_CT 0
#define [=hackname _up=]_RE_CT 0
#define a[=hackname _cap=]Tests (tTestDesc*)NULL[= #define a[=hackname _cap=]Tests (tTestDesc*)NULL[=
_ENDIF =] _ENDIF =]
...@@ -136,12 +160,8 @@ tTestDesc a[=hackname _cap=]Tests[] = {[= ...@@ -136,12 +160,8 @@ tTestDesc a[=hackname _cap=]Tests[] = {[=
const char* apz[=hackname _cap=]Patch[] = {[= const char* apz[=hackname _cap=]Patch[] = {[=
_IF sed _exist =] "sed"[=_FOR sed=], _IF sed _exist =] "sed"[=_FOR sed=],
"-e", [=sed _str=][=/sed=][= "-e", [=sed _str=][=/sed=][=
_ELIF replacement _exist =] "sed",
"s@[=select[]=]@[=replacement=]@"[=
_ELIF shell _exist =] "sh", "-c", _ELIF shell _exist =] "sh", "-c",
[=shell _str=][= [=shell _str=][=
_ELSE =][=_ERROR hackname _get "Error: %s has two fixup specifications"
_printf =][=
_ENDIF=], _ENDIF=],
(char*)NULL }; (char*)NULL };
...@@ -150,10 +170,9 @@ const char* apz[=hackname _cap=]Patch[] = {[= ...@@ -150,10 +170,9 @@ const char* apz[=hackname _cap=]Patch[] = {[=
* *
* List of all fixes * List of all fixes
*/ */
#define REGEX_COUNT [=_eval fix.select _count #define REGEX_COUNT [=_eval "echo $re_ct" _shell =]
fix.bypass _count + =]
#define FIX_COUNT [=_eval fix _count =] #define FIX_COUNT [=_eval fix _count =]
tFixDesc fixDescList[ [=_eval fix _count =] ] = {[= tFixDesc fixDescList[ FIX_COUNT ] = {[=
_FOR fix ",\n" =] _FOR fix ",\n" =]
......
...@@ -328,11 +328,13 @@ fix = { ...@@ -328,11 +328,13 @@ fix = {
fix = { fix = {
hackname = no_double_slash; 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$)\'`"'; test = '-z `echo ${file} | egrep \'(cxx|\+\+)/\' `';
select = '//[^"*]'; select = '(^|[^:])//[^"*]';
sed = '/\/\/[^"*]/' "s|//.*$||g"; sed = '/\(^|[^:]\)\/\/[^"*]/' "s|//.*$||g";
}; };
...@@ -827,14 +829,12 @@ fix = { ...@@ -827,14 +829,12 @@ fix = {
exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]" exesel = "^#[ \t]*(if|elif).*[^a-zA-Z0-9_]"
"(" "("
"M32" "M32"
"|_*(" "|_*MIPSE[LB]"
"MIPSE[LB]" "|_*SYSTYPE_[A-Z0-9]"
"|SYSTYPE_[A-Z0-9]" "|_*[Rr][34]000"
"|[Rr][34]000" "|_*host_mips"
"|host_mips" "|_*i386"
"|i386" "|_*mips"
"|mips"
")($|[^a-zA-Z0-9_])"
"|bsd4" "|bsd4"
"|is68k" "|is68k"
"|m[68]8k" "|m[68]8k"
......
...@@ -15,6 +15,9 @@ sh ...@@ -15,6 +15,9 @@ sh
# #
# See README-fixinc for more information. # See README-fixinc for more information.
# #
# fixincludes copyright (c) [=_eval "date +%Y" _shell
=] The Free Software Foundation, Inc.
#
[=_eval fixincludes "## " _gpl=] [=_eval fixincludes "## " _gpl=]
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
...@@ -334,9 +337,9 @@ while [ $# != 0 ]; do ...@@ -334,9 +337,9 @@ while [ $# != 0 ]; do
cd ${INPUT}[= cd ${INPUT}[=
_IF PROGRAM _env ! =] _IF PROGRAM _env ! =]
files=`if $LINKS; then 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 else
find ${FIND_BASE}/. -type f -print find ${FIND_BASE}/. -name '*.h' -type f -print
fi | \ fi | \
sed -e 's;/\./;/;g' -e 's;//*;/;g' ` sed -e 's;/\./;/;g' -e 's;//*;/;g' `
[= [=
...@@ -347,9 +350,9 @@ _IF PROGRAM _env ! =] ...@@ -347,9 +350,9 @@ _IF PROGRAM _env ! =]
=] =]
required="$required `if $LINKS; then 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 else
find ${FIND_BASE}/. -type f -print find ${FIND_BASE}/. -name '*.h' -type f -print
fi | \ fi | \
sed -e 's;/\./;/;g' -e 's;//*;/;g' | \ sed -e 's;/\./;/;g' -e 's;//*;/;g' | \
${FIXINCL}`"[= ${FIXINCL}`"[=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment