From dd21ceeef0ac419e7dbe8183ef725bcf0dd02bd0 Mon Sep 17 00:00:00 2001 From: ljrittle Date: Fri, 4 Apr 2003 21:46:49 +0000 Subject: [PATCH] * fixinc/inclhack.def (bsd_stdio_attrs_conflict): New. * fixinc/fixincl.x: Rebuilt. * fixinc/tests/base/stdio.h: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65248 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/fixinc/fixincl.x | 46 +++++++++++++++++++++++++++++++++++++++++++ gcc/fixinc/inclhack.def | 20 +++++++++++++++++++ gcc/fixinc/tests/base/stdio.h | 7 +++++++ 4 files changed, 79 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 822d403f6c0..c15b2c255e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-04-04 Loren James Rittle + + * fixinc/inclhack.def (bsd_stdio_attrs_conflict): New. + * fixinc/fixincl.x: Rebuilt. + * fixinc/tests/base/stdio.h: Regenerated. + 2003-04-04 Nathan Sidwell * gcov.c (accumulate_line_counts): Fix span tree merge bug. diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index fd9d3311e55..8391b416e9e 100644 --- a/gcc/fixinc/fixincl.x +++ b/gcc/fixinc/fixincl.x @@ -1117,6 +1117,46 @@ static const char* apzBadquotePatch[] = { /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Bsd_Stdio_Attrs_Conflict fix + */ +tSCC zBsd_Stdio_Attrs_ConflictName[] = + "bsd_stdio_attrs_conflict"; + +/* + * File name selection pattern + */ +tSCC zBsd_Stdio_Attrs_ConflictList[] = + "|stdio.h|"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzBsd_Stdio_Attrs_ConflictMachs[] = { + "*-*-*bsd*", + "*-*-*darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zBsd_Stdio_Attrs_ConflictSelect0[] = + "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$"; + +#define BSD_STDIO_ATTRS_CONFLICT_TEST_CT 1 +static tTestDesc aBsd_Stdio_Attrs_ConflictTests[] = { + { TT_EGREP, zBsd_Stdio_Attrs_ConflictSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Bsd_Stdio_Attrs_Conflict + */ +static const char* apzBsd_Stdio_Attrs_ConflictPatch[] = { + "format", + "#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)\n\ +#define _BSD_STRINGX(_BSD_X) #_BSD_X\n\ +int vfscanf(FILE *, const char *, __builtin_va_list) __asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) \"__svfscanf\");", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Broken_Assert_Stdio fix */ tSCC zBroken_Assert_StdioName[] = @@ -5871,6 +5911,7 @@ typedef enum { BAD_LVAL_FIXIDX, BAD_STRUCT_TERM_FIXIDX, BADQUOTE_FIXIDX, + BSD_STDIO_ATTRS_CONFLICT_FIXIDX, BROKEN_ASSERT_STDIO_FIXIDX, BROKEN_ASSERT_STDLIB_FIXIDX, BROKEN_CABS_FIXIDX, @@ -6122,6 +6163,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { BADQUOTE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aBadquoteTests, apzBadquotePatch, 0 }, + { zBsd_Stdio_Attrs_ConflictName, zBsd_Stdio_Attrs_ConflictList, + apzBsd_Stdio_Attrs_ConflictMachs, + BSD_STDIO_ATTRS_CONFLICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aBsd_Stdio_Attrs_ConflictTests, apzBsd_Stdio_Attrs_ConflictPatch, 0 }, + { zBroken_Assert_StdioName, zBroken_Assert_StdioList, apzBroken_Assert_StdioMachs, BROKEN_ASSERT_STDIO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def index 763df48270c..525641231b5 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -724,6 +724,26 @@ fix = { /* + * Various systems derived from BSD4.4 contain a macro definition + * for vfscanf that interacts badly with requirements of builtin-attrs.def. + * Known to be fixed in FreeBSD 5 system headers. + */ +fix = { + hackname = bsd_stdio_attrs_conflict; + mach = *-*-*bsd*; + mach = *-*-*darwin*; + files = stdio.h; + select = "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$"; + c_fix = format; + c_fix_arg = '#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X)' "\n" + '#define _BSD_STRINGX(_BSD_X) #_BSD_X' "\n" + 'int vfscanf(FILE *, const char *, __builtin_va_list) ' + '__asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf");'; + test_text = '#define vfscanf __svfscanf'; +}; + + +/* * check for broken assert.h that needs stdio.h */ fix = { diff --git a/gcc/fixinc/tests/base/stdio.h b/gcc/fixinc/tests/base/stdio.h index bfa929fb666..d0eadbc5c63 100644 --- a/gcc/fixinc/tests/base/stdio.h +++ b/gcc/fixinc/tests/base/stdio.h @@ -19,6 +19,13 @@ extern int getopt(int, char *const[], const char *); #endif /* ALPHA_GETOPT_CHECK */ +#if defined( BSD_STDIO_ATTRS_CONFLICT_CHECK ) +#define _BSD_STRING(_BSD_X) _BSD_STRINGX(_BSD_X) +#define _BSD_STRINGX(_BSD_X) #_BSD_X +int vfscanf(FILE *, const char *, __builtin_va_list) __asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) "__svfscanf"); +#endif /* BSD_STDIO_ATTRS_CONFLICT_CHECK */ + + #if defined( HPUX11_VSNPRINTF_CHECK ) extern int vsnprintf(char *, _hpux_size_t, const char *, __gnuc_va_list); #endif /* HPUX11_VSNPRINTF_CHECK */ -- 2.11.0