X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ffixinc%2Ffixincl.tpl;h=e8aefd05dfe18788771dcc4f67c6d84d77a12a0c;hb=f13c61f87a185d403dcbe2dffcceccf3edbb5abc;hp=bbe76e0dba342e9da2d9c794f590bb1e2dd5308a;hpb=a98784e983c20f5456f8ee49c48689f8b192a04f;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/fixinc/fixincl.tpl b/gcc/fixinc/fixincl.tpl index bbe76e0dba3..e8aefd05dfe 100644 --- a/gcc/fixinc/fixincl.tpl +++ b/gcc/fixinc/fixincl.tpl @@ -1,5 +1,5 @@ -[= autogen template -*- Mode: C -*- -x =] +[= AutoGen5 Template -*- Mode: C -*- +x=fixincl.x =] /* * DO NOT EDIT THIS FILE - it has been generated * @@ -7,219 +7,210 @@ x =] * files which are fixed to work correctly with ANSI C and placed in a * directory that GNU C will search. * - * This file contains [=_eval fix _count =] fixup descriptions. + * This file contains [=(count "fix")=] fixup descriptions. * - * See README-fixinc for more information. + * See README for more information. * - * inclhack copyright (c) [=_eval "date +%Y" _shell - =] The Free Software Foundation, Inc. + * inclhack copyright (c) 1998, 1999, 2000, 2001 + * The Free Software Foundation, Inc. * -[=_eval inclhack "# * " _gpl=] - *[=_EVAL "re_ct=0\nmax_mach=0" _shell=][= + [=(define re-ct 0) (define max-mach 0) (define ct 0) + (define HACK "") (define Hack "") (define tmp "") + (gpl "inclhack" " * ")=] + */ +[= -_FOR fix =] +FOR fix =] +/* * * * * * * * * * * * * * * * * * * * * * * * * * * - * Description of [=hackname _Cap=] fix - */ -#define [=hackname _up #_FIXIDX + #%-32s _printf=] [=_eval _index=] -tSCC z[=hackname _cap=]Name[] = - [=hackname _cap _krstr=]; + * Description of [= + (set! Hack (string-capitalize! (get "hackname"))) + (set! HACK (string-upcase! (get "hackname"))) + (if (and (not (exist? "test_text")) (not (exist? "replace"))) + (error (sprintf "include fix '%s' has no test text" Hack )) ) + (. Hack)=] fix + */[= + +# Note that this is not just for debugging purposes, but in case + some C fix wishes to refer to the regexps it is paired with. + See commentary at the top of fixfixes.c. +=] +tSCC z[=(. Hack)=]Name[] = + "[=hackname=]"; + /* * File name selection pattern */[= - _IF files _exist=] -tSCC z[=hackname _cap=]List[] = - "[=_FOR files =]|[=files=][=/files=]|";[= + IF (exist? "files")=] +tSCC z[=(. Hack)=]List[] = + "[=FOR files =]|[=files=][=ENDFOR=]|";[= - _ELSE =] -#define z[=hackname _cap=]List (char*)NULL[= - _ENDIF "files _exist" =] + ELSE =] +#define z[=(. Hack)=]List (char*)NULL[= + ENDIF (exist? "files") =] /* * Machine/OS name selection pattern */[= - _IF mach _exist=] -tSCC* apz[=hackname _cap=]Machs[] = {[= - _EVAL "this_mach=0" _shell =][= + IF (exist? "mach")=] +tSCC* apz[=(. Hack)=]Machs[] = {[= + (set! ct 0) =][= - _FOR mach =] - [=mach _krstr=],[= - _EVAL mach _len "this_mach=`expr $this_mach + %d + 5`" - _printf _shell =][= - /mach=] + FOR mach =] + [= + (set! tmp (get "mach")) + (set! ct (+ ct (string-length tmp) 5)) + (kr-string tmp)=],[= + ENDFOR=] (const char*)NULL };[= - _EVAL "if [ $this_mach -gt $max_mach ] ; then max_mach=$this_mach ; fi" - _shell =][= + (if (> ct max-mach) (set! max-mach ct)) =][= - _ELSE =] -#define apz[=hackname _cap=]Machs (const char**)NULL[= - _ENDIF "files _exist" =][= + ELSE =] +#define apz[=(. Hack)=]Machs (const char**)NULL[= + ENDIF (exist? "files") =][= - _IF exesel _exist=] + IF (exist? "select")=] /* * 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=][] = - [=exesel _krstr=];[= - /exesel =][= + FOR select =] +tSCC z[=(. Hack)=]Select[=(for-index)=][] = + [=(kr-string (get "select"))=];[= + ENDFOR select =][= + ENDIF =][= - _ELIF select _exist=] - -/* - * content selection pattern - do fix if pattern found - */[= - _FOR select =] -tSCC z[=hackname _cap=]Select[=_eval _index=][] = - [=select _krstr=];[= - /select =][= - _ENDIF =][= - - _IF bypass _exist=] + IF (exist? "bypass")=] /* * content bypass pattern - skip fix if pattern found */[= - _FOR bypass =] -tSCC z[=hackname _cap=]Bypass[=_eval _index=][] = - [=bypass _krstr=];[= - /bypass =][= - _ENDIF =][= + FOR bypass =] +tSCC z[=(. Hack)=]Bypass[=(for-index)=][] = + [=(kr-string (get "bypass"))=];[= + ENDFOR bypass =][= + ENDIF =][= - _IF test _exist=] + IF (exist? "test")=] /* * perform the 'test' shell command - do fix on success */[= - _FOR test =] -tSCC z[=hackname _cap=]Test[=_eval _index=][] = - [=test _krstr=];[= - /test =][= - _ENDIF =][= + FOR test =] +tSCC z[=(. Hack)=]Test[=(for-index)=][] = + [=(kr-string (get "test"))=];[= + ENDFOR =][= + ENDIF =][= - _IF c_test _exist=] + IF (exist? "c_test")=] /* * perform the C function call test */[= - _FOR c_test =] -tSCC z[=hackname _cap=]FTst[=_eval _index=][] = "[=c_test=]";[= - /c_test =][= - _ENDIF =][= - + FOR c_test =] +tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[= + ENDFOR c_test =][= + ENDIF =][= -# Build the array of test descriptions for this fix: =][= + IF (set! ct (+ (count "select") (count "bypass") + (count "test") (count "c_test"))) - _IF exesel _exist - select _exist | - bypass _exist | - test _exist | - c_test _exist | + (= ct 0) =] +#define [=(. HACK)=]_TEST_CT 0 +#define a[=(. Hack)=]Tests (tTestDesc*)NULL[= + ELSE =] + +#define [=(. HACK)=]_TEST_CT [=(. ct)=][= + (set! re-ct (+ re-ct (count "select") (count "bypass"))) =] +static tTestDesc a[=(. Hack)=]Tests[] = {[= -#define [=hackname _up =]_TEST_CT [= - _IF exesel _exist =][= - _eval exesel _count - bypass _count + - test _count + - c_test _count + - "ct=%d ; re_ct=`expr $ct + $re_ct` ; echo $ct" - _printf _shell =][= - _ELSE =][= - _eval select _count - bypass _count + - test _count + - c_test _count + - "ct=%d ; re_ct=`expr $ct + $re_ct` ; echo $ct" - _printf _shell =][= - _ENDIF =] -tTestDesc a[=hackname _cap=]Tests[] = {[= - - _FOR test =] - { TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[= - /test =][= - - _FOR c_test =] - { TT_FUNCTION, z[=hackname _cap=]FTst[=_eval _index=], 0 /* unused */ },[= - /c_test =][= - - _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 },[= - /exesel =][= - - _ELSE =][= - _FOR select =] - { TT_EGREP, z[=hackname _cap=]Select[=_eval _index=], (regex_t*)NULL },[= - /select =][= - _ENDIF =] };[= - _ELSE =] -#define [=hackname _up=]_TEST_CT 0 -#define a[=hackname _cap=]Tests (tTestDesc*)NULL[= - _ENDIF =] + FOR test =] + { TT_TEST, z[=(. Hack)=]Test[=(for-index)=], 0 /* unused */ },[= + ENDFOR test =][= + + FOR c_test =] + { TT_FUNCTION, z[=(. Hack)=]FTst[=(for-index)=], 0 /* unused */ },[= + ENDFOR c_test =][= + + FOR bypass =] + { TT_NEGREP, z[=(. Hack)=]Bypass[=(for-index)=], (regex_t*)NULL },[= + ENDFOR bypass =][= + + FOR select =] + { TT_EGREP, z[=(. Hack)=]Select[=(for-index)=], (regex_t*)NULL },[= + ENDFOR select =] };[= + ENDIF =] /* - * Fix Command Arguments for [=hackname _cap=] + * Fix Command Arguments for [=(. Hack)=] */ -const char* apz[=hackname _cap=]Patch[] = {[= - _IF sed _exist =] "sed"[= - _FOR sed=], - "-e", [=sed _krstr=][= - /sed=],[= +static const char* apz[=(. Hack)=]Patch[] = {[= + IF (exist? "sed")=] "sed"[= + FOR sed=], + "-e", [=(kr-string (get "sed"))=][= + ENDFOR sed=],[= + + ELIF (exist? "shell")=] "sh", "-c", + [=(kr-string (get "shell"))=],[= - _ELIF shell _exist =] "sh", "-c", - [=shell _krstr=],[= + ELIF (exist? "c_fix")=] + [=(kr-string (get "c_fix"))=],[= - _ELIF c_fix _exist =]"[=c_fix=]",[= + FOR c_fix_arg =] + [=(kr-string (get "c_fix_arg"))=],[= + ENDFOR c_fix_arg =][= - _ELIF replace _len =] -[=replace _krstr=],[= + ELIF (> (len "replace") 0) =] +[=(kr-string (get "replace"))=],[= - _ENDIF=] + ENDIF=] (char*)NULL }; +[=ENDFOR fix=] -/* * * * * * * * * * * * * * * * * * * * * * * * * *[= -/fix=] +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * List of all fixes - */ -[=_EVAL ' -echo "#define REGEX_COUNT $re_ct" -echo "#define MACH_LIST_SIZE_LIMIT `expr $max_mach + 128`" ' _shell =][= - + */[= # as of this writing, 49 bytes are needed by the case statement format. We also must allow for the size of the target machine machine name. This allows for a 79 byte machine name. Better be enough. =] -#define FIX_COUNT [=_eval fix _count =] +#define REGEX_COUNT [= (. re-ct) =] +#define MACH_LIST_SIZE_LIMIT [= (+ 128 max-mach) =] +#define FIX_COUNT [= (count "fix") =] + +/* + * Enumerate the fixes[= # in a way that minimizes diffs :-) =] + */ +typedef enum {[= + +FOR fix "," =] + [=(string-upcase! (get "hackname"))=]_FIXIDX[= +ENDFOR + +=] +} t_fixinc_idx; tFixDesc fixDescList[ FIX_COUNT ] = {[= -_FOR fix ",\n" =] - { z[=hackname _cap=]Name, z[=hackname _cap=]List, - apz[=hackname _cap=]Machs, (regex_t*)NULL, - [=hackname _up=]_TEST_CT, [= - _IF not_machine _exist =]FD_MACH_IFNOT[= - _ELSE =]FD_MACH_ONLY[= - _ENDIF =][= - _IF shell _exist =] | FD_SHELL_SCRIPT[= - _ELIF c_fix _exist =] | FD_SUBROUTINE[= - _ELIF replace _exist =] | FD_REPLACEMENT[= - _ENDIF =], - a[=hackname _cap=]Tests, apz[=hackname _cap=]Patch }[= - -/fix=] +FOR fix ",\n" =][= + (set! Hack (string-capitalize! (get "hackname"))) + (set! HACK (string-upcase! (get "hackname"))) =] + { z[=(. Hack)=]Name, z[=(. Hack)=]List, + apz[=(. Hack)=]Machs, + [=(. HACK)=]_TEST_CT, [= + IF (exist? "not_machine") =]FD_MACH_IFNOT[= + ELSE =]FD_MACH_ONLY[= + ENDIF =][= + IF (exist? "shell") =] | FD_SHELL_SCRIPT[= + ELIF (exist? "c_fix") =] | FD_SUBROUTINE[= + ELIF (exist? "replace") =] | FD_REPLACEMENT[= + ENDIF =], + a[=(. Hack)=]Tests, apz[=(. Hack)=]Patch, 0 }[= + +ENDFOR =] };