Commit 7b78a14a by Bruce Korb

reorganize inclhacks and apply fix to fixtests.c

From-SVN: r42663
parent f71aebba
2001-05-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fixinc/fixtests.c: Declare entries in ENV_TABLE.
2001-05-27 Bruce Korb <bkorb@gnu.org>
* fixinc/check.tpl(HACK) add and use a Scheme variable
(has no test text): error out if no "test_text" is defined
* fixinc/fixincl.tpl: likewise
(FIXIDX): make it an enumeration so we minimize diffs
* fixinc/inclhack.def: re-alphabetize and add sort instructions
* fixinc/fixincl.x: regenerate
* fixinc/tests/base/stdio.h: test output got moved due to
the alphabetizing
* README-fixinc: rewrite (mostly)
2001-05-27 Neil Booth <neil@daikokuya.demon.co.uk>
* cpplib.c (run_directive): Set pfile->directive.
......
This README file is copied into the directory for GCC-only header files
when fixincludes is run by the makefile for GCC.
Many of the files in this directory were made from the standard system
header files of this system by the shell script `fixincludes'.
They are system-specific, and will not work on any other kind of system.
They are also not part of GCC. The reason for making the files here
is to fix the places in the header files which use constructs
that are incompatible with ANSI C.
Many of the files in this directory were automatically edited from the
standard system header files by the fixincludes process. They are
system-specific, and will not work on any other kind of system. They
are also not part of GCC. The reason we have to do this is because
GCC requires ANSI C headers and many vendors supply ANSI-incompatible
headers.
Because this is an automated process, sometimes headers get "fixed"
that do not, strictly speaking, need a fix. As long as nothing is broken
by the process, it is just an unfortunate collateral inconvenience.
We would like to rectify it, if it is not "too inconvenient".
......@@ -40,12 +40,13 @@ mkdir ${DESTDIR} ${SRCDIR}
cd inc
[=
(define sfile "")
(define HACK "")
(define dfile "") =][=
FOR fix =][=
IF (> (count "test_text") 1) =][=
(set! HACK (string-upcase! (get "hackname")))
(set! sfile (if (exist? "files") (get "files[]") "testing.h"))
(set! dfile (string-append
(if (*==* sfile "/")
......@@ -58,9 +59,9 @@ FOR fix =][=
cat >> [=(. sfile)=] <<_HACK_EOF_
#if defined( [=(string-upcase! (get "hackname"))=]_CHECK_[=(for-index)=] )
#if defined( [=(. HACK)=]_CHECK_[=(for-index)=] )
[=test_text=]
#endif /* [=(string-upcase! (get "hackname"))=]_CHECK_[=(for-index)=] */
#endif /* [=(. HACK)=]_CHECK_[=(for-index)=] */
_HACK_EOF_
echo [=(. sfile)=] | ../../fixincl
mv -f [=(. sfile)=] [=(. dfile)=]-[=(for-index)=].h
......@@ -75,17 +76,15 @@ ENDFOR fix
=][=
FOR fix =][=
FOR fix =][=
(set! HACK (string-upcase! (get "hackname"))) =][=
IF (not (exist? "test_text")) =][=
IF (not (exist? "replace")) =]
echo No test for [=hackname=] in inc/[=
IF (exist? "files") =][=
files[0] =][=
ELSE =]testing.h[=
ENDIF =][=
ENDIF =][=
ELSE =]
(if (not (exist? "replace"))
(error (sprintf "include fix '%s' has no test text"
(get "hackname") )) )
=][=
ELSE =]
cat >> [=
IF (exist? "files") =][=
files[0] =][=
......@@ -93,9 +92,9 @@ cat >> [=
ENDIF =] <<_HACK_EOF_
#if defined( [=(string-upcase! (get "hackname"))=]_CHECK )
#if defined( [=(. HACK)=]_CHECK )
[=test_text=]
#endif /* [=(string-upcase! (get "hackname"))=]_CHECK */
#endif /* [=(. HACK)=]_CHECK */
_HACK_EOF_
[=ENDIF =][=
......@@ -103,7 +102,7 @@ ENDFOR fix
=]
find . -type f | sed 's;\./;;' | sort | ../../fixincl
find . -type f | sed 's;^\./;;' | sort | ../../fixincl
cd ${DESTDIR}
exitok=true
......
......@@ -30,14 +30,6 @@ Here are the rules:
This may be useful, for example, if there are interesting strings
or pre-compiled regular expressions stored there.
It is also possible to access fix descriptions by using the
index of a known fix, "my_fix_name" for example:
tFixDesc* p_desc = fixDescList + MY_FIX_NAME_FIXIDX;
tTestDesc* p_tlist = p_desc->p_test_desc;
regexec (p_tlist->p_test_regex, ...)
= = = = = = = = = = = = = = = = = = = = = = = = =
This file is part of GNU CC.
......
......@@ -26,6 +26,8 @@ FOR fix =]
* 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
*/[=
......@@ -33,7 +35,6 @@ FOR fix =]
some C fix wishes to refer to the regexps it is paired with.
See commentary at the top of fixfixes.c.
=]
#define [=(sprintf "%-32s" (string-append HACK "_FIXIDX"))=] [=(for-index)=]
tSCC z[=(. Hack)=]Name[] =
"[=hackname=]";
......@@ -181,6 +182,18 @@ static const char* apz[=(. Hack)=]Patch[] = {[=
#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 ] = {[=
......
......@@ -47,6 +47,10 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h"
#define _ENV_(v,m,n,t) extern tCC* v;
ENV_TABLE
#undef _ENV_
typedef apply_fix_p_t t_test_proc PARAMS(( tCC* file, tCC* text ));
typedef struct {
......
......@@ -19,6 +19,11 @@ extern int getopt(int, char *const[], const char *);
#endif /* ALPHA_GETOPT_CHECK */
#if defined( IRIX_STDIO_DUMMY_VA_LIST_CHECK )
extern int printf( const char *, __gnuc_va_list );
#endif /* IRIX_STDIO_DUMMY_VA_LIST_CHECK */
#if defined( ISC_OMITS_WITH_STDC_CHECK )
#if !defined(_POSIX_SOURCE) /* ? ! */
int foo;
......@@ -26,11 +31,6 @@ int foo;
#endif /* ISC_OMITS_WITH_STDC_CHECK */
#if defined( IRIX_STDIO_DUMMY_VA_LIST_CHECK )
extern int printf( const char *, __gnuc_va_list );
#endif /* IRIX_STDIO_DUMMY_VA_LIST_CHECK */
#if defined( READ_RET_TYPE_CHECK )
extern unsigned int fread(), fwrite();
extern int fclose(), fflush(), foo();
......
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