From b51207a4d29a4ab03968c8a34e92391c69886c82 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Mon, 17 Jan 2000 21:45:29 +0000 Subject: [PATCH] fixlib.c: Add copyright notice. * fixinc/fixlib.c: Add copyright notice. (compile_re): New function. * fixinc/fixlib.h: Prototype compile_re. * fixinc/fixfixes.c, fixinc/fixtests.c, fixinc/fixincl.c: Use compile_re to compile regular expressions. * fixinc/fixincl.c (egrep_test): Don't bother asking regexec where the pattern matched. * fixinc/inclhack.def (sun_memcpy): Move to AAB_sun_memcpy, use 'replace'. (ultrix_ansi_compat): Likewise. (interactv_add1): Rename to 'isc_omits_with_stdc', remove shell test, add egrep test. (interactv_add2, interactv_add3): Delete. (x11_sprintf): Don't use filename glob. * fixinc/fixincl.x, fixinc/inclhack.sh, fixinc/fixincl.sh: Regenerate. From-SVN: r31474 --- gcc/fixinc/fixfixes.c | 7 +- gcc/fixinc/fixincl.c | 40 +--- gcc/fixinc/fixincl.sh | 4 +- gcc/fixinc/fixincl.x | 460 ++++++++++++++++------------------------ gcc/fixinc/fixlib.c | 59 ++++++ gcc/fixinc/fixlib.h | 5 +- gcc/fixinc/fixtests.c | 7 +- gcc/fixinc/inclhack.def | 140 ++++++------ gcc/fixinc/inclhack.sh | 184 ++++++---------- 9 files changed, 391 insertions(+), 515 deletions(-) diff --git a/gcc/fixinc/fixfixes.c b/gcc/fixinc/fixfixes.c index e1e394dafc8..b701c05ccc2 100644 --- a/gcc/fixinc/fixfixes.c +++ b/gcc/fixinc/fixfixes.c @@ -3,7 +3,7 @@ Test to see if a particular fix should be applied to a header file. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. = = = = = = = = = = = = = = = = = = = = = = = = = @@ -191,9 +191,8 @@ FIX_PROC_HEAD( else_endif_label_fix ) char* pz_next = (char*)NULL; regmatch_t match[2]; - re_set_syntax (RE_SYNTAX_EGREP); - (void)re_compile_pattern (label_pat, sizeof (label_pat)-1, - &label_re); + compile_re (label_pat, &label_re, 1, + "label pattern", "else_endif_label_fix"); for (;;) /* entire file */ { diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c index cdb12a66b62..9c40cde20e8 100644 --- a/gcc/fixinc/fixincl.c +++ b/gcc/fixinc/fixincl.c @@ -3,7 +3,7 @@ files which are fixed to work correctly with ANSI C and placed in a directory that GNU C will search. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. @@ -533,8 +533,6 @@ load_file ( fname ) void run_compiles () { - tSCC z_bad_comp[] = "fixincl ERROR: cannot compile %s regex for %s\n\ -\texpr = `%s'\n\terror %s\n"; tFixDesc *p_fixd = fixDescList; int fix_ct = FIX_COUNT; tTestDesc *p_test; @@ -550,26 +548,13 @@ run_compiles () exit (EXIT_FAILURE); } - /* Make sure re_compile_pattern does not stumble across invalid - data */ + /* Make sure compile_re does not stumble across invalid data */ memset ( (void*)p_re, '\0', REGEX_COUNT * sizeof (regex_t) ); memset ( (void*)&incl_quote_re, '\0', sizeof (regex_t) ); - /* The patterns we search for are all egrep patterns. - In the shell version of this program, we invoke egrep - with the supplied pattern. Here, we will run - re_compile_pattern, but it must be using the same rules. */ - - re_set_syntax (RE_SYNTAX_EGREP); - pz_err = re_compile_pattern (incl_quote_pat, sizeof (incl_quote_pat)-1, - &incl_quote_re); - if (pz_err != (char *) NULL) - { - fprintf (stderr, z_bad_comp, "quoted include", "run_compiles", - incl_quote_pat, pz_err); - exit (EXIT_FAILURE); - } + compile_re (incl_quote_pat, &incl_quote_re, 1, + "quoted include", "run_compiles"); /* FOR every fixup, ... */ do @@ -669,16 +654,9 @@ run_compiles () } p_test->p_test_regex = p_re++; - pz_err = re_compile_pattern (p_test->pz_test_text, - strlen (p_test->pz_test_text), - p_test->p_test_regex); - if (pz_err != (char *) NULL) - { - fprintf (stderr, z_bad_comp, "select test", p_fixd->fix_name, - p_test->pz_test_text, pz_err); - exit (EXIT_FAILURE); - } - } + compile_re (p_test->pz_test_text, p_test->p_test_regex, 0, + "select test", p_fixd->fix_name); + } p_test++; } } @@ -815,14 +793,12 @@ egrep_test (pz_data, p_test) char *pz_data; tTestDesc *p_test; { - regmatch_t match; - #ifdef DEBUG if (p_test->p_test_regex == 0) fprintf (stderr, "fixincl ERROR RE not compiled: `%s'\n", p_test->pz_test_text); #endif - if (regexec (p_test->p_test_regex, pz_data, 1, &match, 0) == 0) + if (regexec (p_test->p_test_regex, pz_data, 0, 0, 0) == 0) return APPLY_FIX; return SKIP_FIX; } diff --git a/gcc/fixinc/fixincl.sh b/gcc/fixinc/fixincl.sh index 7cfcdf621cc..809c807b8b7 100755 --- a/gcc/fixinc/fixincl.sh +++ b/gcc/fixinc/fixincl.sh @@ -6,11 +6,11 @@ # files which are fixed to work correctly with ANSI C and placed in a # directory that GNU C will search. # -# This script contains 114 fixup scripts. +# This script contains 112 fixup scripts. # # See README-fixinc for more information. # -# fixincludes copyright (c) 1999 The Free Software Foundation, Inc. +# fixincludes copyright (c) 2000 The Free Software Foundation, Inc. # # fixincludes is free software. # diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x index ed4e1b61b99..c3bdc589363 100644 --- a/gcc/fixinc/fixincl.x +++ b/gcc/fixinc/fixincl.x @@ -5,11 +5,11 @@ * files which are fixed to work correctly with ANSI C and placed in a * directory that GNU C will search. * - * This file contains 114 fixup descriptions. + * This file contains 112 fixup descriptions. * * See README-fixinc for more information. * - * inclhack copyright (c) 1999 The Free Software Foundation, Inc. + * inclhack copyright (c) 2000 The Free Software Foundation, Inc. * * inclhack is free software. * @@ -455,11 +455,63 @@ const char* apzAab_Fd_Zero_Selectbits_HPatch[] = { #endif /* _SELECTBITS_H_WRAPPER */\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aab_Sun_Memcpy fix + */ +#define AAB_SUN_MEMCPY_FIXIDX 10 +tSCC zAab_Sun_MemcpyName[] = + "Aab_Sun_Memcpy"; +/* + * File name selection pattern + */ +tSCC zAab_Sun_MemcpyList[] = + "|memory.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzAab_Sun_MemcpyMachs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAab_Sun_MemcpySelect0[] = + "/\\*\t@\\(#\\)(head/memory.h\t50.1\t |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/"; + +#define AAB_SUN_MEMCPY_TEST_CT 1 +tTestDesc aAab_Sun_MemcpyTests[] = { + { TT_EGREP, zAab_Sun_MemcpySelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aab_Sun_Memcpy + */ +const char* apzAab_Sun_MemcpyPatch[] = { +"/* This file was generated by fixincludes */\n\ +#ifndef __memory_h__\n\ +#define __memory_h__\n\ +\n\ +#ifdef __STDC__\n\ +extern void *memccpy();\n\ +extern void *memchr();\n\ +extern void *memcpy();\n\ +extern void *memset();\n\ +#else\n\ +extern char *memccpy();\n\ +extern char *memchr();\n\ +extern char *memcpy();\n\ +extern char *memset();\n\ +#endif /* __STDC__ */\n\ +\n\ +extern int memcmp();\n\ +\n\ +#endif /* __memory_h__ */\n", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aab_Svr4_Replace_Byteorder fix */ -#define AAB_SVR4_REPLACE_BYTEORDER_FIXIDX 10 +#define AAB_SVR4_REPLACE_BYTEORDER_FIXIDX 11 tSCC zAab_Svr4_Replace_ByteorderName[] = "Aab_Svr4_Replace_Byteorder"; /* @@ -630,11 +682,45 @@ ntohs (unsigned int __arg)\n\ #endif\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aab_Ultrix_Ansi_Compat fix + */ +#define AAB_ULTRIX_ANSI_COMPAT_FIXIDX 12 +tSCC zAab_Ultrix_Ansi_CompatName[] = + "Aab_Ultrix_Ansi_Compat"; +/* + * File name selection pattern + */ +tSCC zAab_Ultrix_Ansi_CompatList[] = + "|ansi_compat.h|"; +/* + * Machine/OS name selection pattern + */ +#define apzAab_Ultrix_Ansi_CompatMachs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAab_Ultrix_Ansi_CompatSelect0[] = + "ULTRIX"; + +#define AAB_ULTRIX_ANSI_COMPAT_TEST_CT 1 +tTestDesc aAab_Ultrix_Ansi_CompatTests[] = { + { TT_EGREP, zAab_Ultrix_Ansi_CompatSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aab_Ultrix_Ansi_Compat + */ +const char* apzAab_Ultrix_Ansi_CompatPatch[] = { +"/* This file intentionally left blank. */\n", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Syswait fix */ -#define AIX_SYSWAIT_FIXIDX 11 +#define AIX_SYSWAIT_FIXIDX 13 tSCC zAix_SyswaitName[] = "Aix_Syswait"; /* @@ -669,7 +755,7 @@ struct rusage;\n", * * Description of Aix_Volatile fix */ -#define AIX_VOLATILE_FIXIDX 12 +#define AIX_VOLATILE_FIXIDX 14 tSCC zAix_VolatileName[] = "Aix_Volatile"; /* @@ -703,7 +789,7 @@ const char* apzAix_VolatilePatch[] = { "sed", * * Description of Alpha_Getopt fix */ -#define ALPHA_GETOPT_FIXIDX 13 +#define ALPHA_GETOPT_FIXIDX 15 tSCC zAlpha_GetoptName[] = "Alpha_Getopt"; /* @@ -737,7 +823,7 @@ const char* apzAlpha_GetoptPatch[] = { "sed", * * Description of Alpha_Parens fix */ -#define ALPHA_PARENS_FIXIDX 14 +#define ALPHA_PARENS_FIXIDX 16 tSCC zAlpha_ParensName[] = "Alpha_Parens"; /* @@ -771,7 +857,7 @@ const char* apzAlpha_ParensPatch[] = { "sed", * * Description of Alpha_Sbrk fix */ -#define ALPHA_SBRK_FIXIDX 15 +#define ALPHA_SBRK_FIXIDX 17 tSCC zAlpha_SbrkName[] = "Alpha_Sbrk"; /* @@ -805,7 +891,7 @@ const char* apzAlpha_SbrkPatch[] = { "sed", * * Description of Arm_Norcroft_Hint fix */ -#define ARM_NORCROFT_HINT_FIXIDX 16 +#define ARM_NORCROFT_HINT_FIXIDX 18 tSCC zArm_Norcroft_HintName[] = "Arm_Norcroft_Hint"; /* @@ -839,7 +925,7 @@ const char* apzArm_Norcroft_HintPatch[] = { "sed", * * Description of Arm_Wchar fix */ -#define ARM_WCHAR_FIXIDX 17 +#define ARM_WCHAR_FIXIDX 19 tSCC zArm_WcharName[] = "Arm_Wchar"; /* @@ -874,7 +960,7 @@ const char* apzArm_WcharPatch[] = { "sed", * * Description of Aux_Asm fix */ -#define AUX_ASM_FIXIDX 18 +#define AUX_ASM_FIXIDX 20 tSCC zAux_AsmName[] = "Aux_Asm"; /* @@ -908,7 +994,7 @@ const char* apzAux_AsmPatch[] = { "sed", * * Description of Avoid_Bool fix */ -#define AVOID_BOOL_FIXIDX 19 +#define AVOID_BOOL_FIXIDX 21 tSCC zAvoid_BoolName[] = "Avoid_Bool"; /* @@ -953,7 +1039,7 @@ const char* apzAvoid_BoolPatch[] = { "sed", * * Description of Bad_Struct_Term fix */ -#define BAD_STRUCT_TERM_FIXIDX 20 +#define BAD_STRUCT_TERM_FIXIDX 22 tSCC zBad_Struct_TermName[] = "Bad_Struct_Term"; /* @@ -987,7 +1073,7 @@ const char* apzBad_Struct_TermPatch[] = { "sed", * * Description of Badquote fix */ -#define BADQUOTE_FIXIDX 21 +#define BADQUOTE_FIXIDX 23 tSCC zBadquoteName[] = "Badquote"; /* @@ -1013,7 +1099,7 @@ const char* apzBadquotePatch[] = { "sed", * * Description of Bad_Lval fix */ -#define BAD_LVAL_FIXIDX 22 +#define BAD_LVAL_FIXIDX 24 tSCC zBad_LvalName[] = "Bad_Lval"; /* @@ -1047,7 +1133,7 @@ const char* apzBad_LvalPatch[] = { "sed", * * Description of Broken_Assert_Stdio fix */ -#define BROKEN_ASSERT_STDIO_FIXIDX 23 +#define BROKEN_ASSERT_STDIO_FIXIDX 25 tSCC zBroken_Assert_StdioName[] = "Broken_Assert_Stdio"; /* @@ -1089,7 +1175,7 @@ const char* apzBroken_Assert_StdioPatch[] = { "sed", * * Description of Broken_Assert_Stdlib fix */ -#define BROKEN_ASSERT_STDLIB_FIXIDX 24 +#define BROKEN_ASSERT_STDLIB_FIXIDX 26 tSCC zBroken_Assert_StdlibName[] = "Broken_Assert_Stdlib"; /* @@ -1133,7 +1219,7 @@ const char* apzBroken_Assert_StdlibPatch[] = { "sed", * * Description of Bsd43_Io_Macros fix */ -#define BSD43_IO_MACROS_FIXIDX 25 +#define BSD43_IO_MACROS_FIXIDX 27 tSCC zBsd43_Io_MacrosName[] = "Bsd43_Io_Macros"; /* @@ -1167,7 +1253,7 @@ const char* apzBsd43_Io_MacrosPatch[] = { "sed", * * Description of Dec_Intern_Asm fix */ -#define DEC_INTERN_ASM_FIXIDX 26 +#define DEC_INTERN_ASM_FIXIDX 28 tSCC zDec_Intern_AsmName[] = "Dec_Intern_Asm"; /* @@ -1196,7 +1282,7 @@ const char* apzDec_Intern_AsmPatch[] = { "sed", * * Description of No_Double_Slash fix */ -#define NO_DOUBLE_SLASH_FIXIDX 27 +#define NO_DOUBLE_SLASH_FIXIDX 29 tSCC zNo_Double_SlashName[] = "No_Double_Slash"; /* @@ -1227,7 +1313,7 @@ const char* apzNo_Double_SlashPatch[] = {"no_double_slash", * * Description of Ecd_Cursor fix */ -#define ECD_CURSOR_FIXIDX 28 +#define ECD_CURSOR_FIXIDX 30 tSCC zEcd_CursorName[] = "Ecd_Cursor"; /* @@ -1253,7 +1339,7 @@ const char* apzEcd_CursorPatch[] = { "sed", * * Description of Sco5_Stat_Wrappers fix */ -#define SCO5_STAT_WRAPPERS_FIXIDX 29 +#define SCO5_STAT_WRAPPERS_FIXIDX 31 tSCC zSco5_Stat_WrappersName[] = "Sco5_Stat_Wrappers"; /* @@ -1289,7 +1375,7 @@ extern \"C\"\\\n\ * * Description of End_Else_Label fix */ -#define END_ELSE_LABEL_FIXIDX 30 +#define END_ELSE_LABEL_FIXIDX 32 tSCC zEnd_Else_LabelName[] = "End_Else_Label"; /* @@ -1320,7 +1406,7 @@ const char* apzEnd_Else_LabelPatch[] = {"else_endif_label", * * Description of Hp_Inline fix */ -#define HP_INLINE_FIXIDX 31 +#define HP_INLINE_FIXIDX 33 tSCC zHp_InlineName[] = "Hp_Inline"; /* @@ -1355,7 +1441,7 @@ const char* apzHp_InlinePatch[] = { "sed", * * Description of Hp_Sysfile fix */ -#define HP_SYSFILE_FIXIDX 32 +#define HP_SYSFILE_FIXIDX 34 tSCC zHp_SysfileName[] = "Hp_Sysfile"; /* @@ -1389,7 +1475,7 @@ const char* apzHp_SysfilePatch[] = { "sed", * * Description of Cxx_Unready fix */ -#define CXX_UNREADY_FIXIDX 33 +#define CXX_UNREADY_FIXIDX 35 tSCC zCxx_UnreadyName[] = "Cxx_Unready"; /* @@ -1431,7 +1517,7 @@ extern \"C\" {\\\n\ * * Description of Hpux_Maxint fix */ -#define HPUX_MAXINT_FIXIDX 34 +#define HPUX_MAXINT_FIXIDX 36 tSCC zHpux_MaxintName[] = "Hpux_Maxint"; /* @@ -1460,7 +1546,7 @@ const char* apzHpux_MaxintPatch[] = { "sed", * * Description of Hpux_Systime fix */ -#define HPUX_SYSTIME_FIXIDX 35 +#define HPUX_SYSTIME_FIXIDX 37 tSCC zHpux_SystimeName[] = "Hpux_Systime"; /* @@ -1494,7 +1580,7 @@ const char* apzHpux_SystimePatch[] = { "sed", * * Description of Hpux8_Bogus_Inlines fix */ -#define HPUX8_BOGUS_INLINES_FIXIDX 36 +#define HPUX8_BOGUS_INLINES_FIXIDX 38 tSCC zHpux8_Bogus_InlinesName[] = "Hpux8_Bogus_Inlines"; /* @@ -1531,7 +1617,7 @@ const char* apzHpux8_Bogus_InlinesPatch[] = { "sed", * * Description of Hpux11_Uint32_C fix */ -#define HPUX11_UINT32_C_FIXIDX 37 +#define HPUX11_UINT32_C_FIXIDX 39 tSCC zHpux11_Uint32_CName[] = "Hpux11_Uint32_C"; /* @@ -1563,116 +1649,38 @@ const char* apzHpux11_Uint32_CPatch[] = { "sed", /* * * * * * * * * * * * * * * * * * * * * * * * * * * - * Description of Interactv_Add1 fix + * Description of Isc_Omits_With_Stdc fix */ -#define INTERACTV_ADD1_FIXIDX 38 -tSCC zInteractv_Add1Name[] = - "Interactv_Add1"; +#define ISC_OMITS_WITH_STDC_FIXIDX 40 +tSCC zIsc_Omits_With_StdcName[] = + "Isc_Omits_With_Stdc"; /* * File name selection pattern */ -tSCC zInteractv_Add1List[] = +tSCC zIsc_Omits_With_StdcList[] = "|stdio.h|math.h|ctype.h|sys/limits.h|sys/fcntl.h|sys/dirent.h|"; /* * Machine/OS name selection pattern */ -#define apzInteractv_Add1Machs (const char**)NULL +#define apzIsc_Omits_With_StdcMachs (const char**)NULL /* - * perform the 'test' shell command - do fix on success + * content selection pattern - do fix if pattern found */ -tSCC zInteractv_Add1Test0[] = - " -d /etc/conf/kconfig.d"; -tSCC zInteractv_Add1Test1[] = - " -n \"`grep _POSIX_VERSION /usr/include/sys/unistd.h`\""; +tSCC zIsc_Omits_With_StdcSelect0[] = + "defined(__STDC__) && !defined(_POSIX_SOURCE)"; -#define INTERACTV_ADD1_TEST_CT 2 -tTestDesc aInteractv_Add1Tests[] = { - { TT_TEST, zInteractv_Add1Test0, 0 /* unused */ }, - { TT_TEST, zInteractv_Add1Test1, 0 /* unused */ }, }; +#define ISC_OMITS_WITH_STDC_TEST_CT 1 +tTestDesc aIsc_Omits_With_StdcTests[] = { + { TT_EGREP, zIsc_Omits_With_StdcSelect0, (regex_t*)NULL }, }; /* - * Fix Command Arguments for Interactv_Add1 + * Fix Command Arguments for Isc_Omits_With_Stdc */ -const char* apzInteractv_Add1Patch[] = { "sed", +const char* apzIsc_Omits_With_StdcPatch[] = { "sed", "-e", "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/", (char*)NULL }; -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Description of Interactv_Add2 fix - */ -#define INTERACTV_ADD2_FIXIDX 39 -tSCC zInteractv_Add2Name[] = - "Interactv_Add2"; -/* - * File name selection pattern - */ -tSCC zInteractv_Add2List[] = - "|math.h|"; -/* - * Machine/OS name selection pattern - */ -#define apzInteractv_Add2Machs (const char**)NULL - -/* - * perform the 'test' shell command - do fix on success - */ -tSCC zInteractv_Add2Test0[] = - " -d /etc/conf/kconfig.d"; -tSCC zInteractv_Add2Test1[] = - " -n \"`grep _POSIX_VERSION /usr/include/sys/unistd.h`\""; - -#define INTERACTV_ADD2_TEST_CT 2 -tTestDesc aInteractv_Add2Tests[] = { - { TT_TEST, zInteractv_Add2Test0, 0 /* unused */ }, - { TT_TEST, zInteractv_Add2Test1, 0 /* unused */ }, }; - -/* - * Fix Command Arguments for Interactv_Add2 - */ -const char* apzInteractv_Add2Patch[] = { "sed", - "-e", "s/fmod(double)/fmod(double, double)/", - (char*)NULL }; - -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Description of Interactv_Add3 fix - */ -#define INTERACTV_ADD3_FIXIDX 40 -tSCC zInteractv_Add3Name[] = - "Interactv_Add3"; -/* - * File name selection pattern - */ -tSCC zInteractv_Add3List[] = - "|sys/limits.h|"; -/* - * Machine/OS name selection pattern - */ -#define apzInteractv_Add3Machs (const char**)NULL - -/* - * perform the 'test' shell command - do fix on success - */ -tSCC zInteractv_Add3Test0[] = - " -d /etc/conf/kconfig.d"; -tSCC zInteractv_Add3Test1[] = - " -n \"`grep _POSIX_VERSION /usr/include/sys/unistd.h`\""; - -#define INTERACTV_ADD3_TEST_CT 2 -tTestDesc aInteractv_Add3Tests[] = { - { TT_TEST, zInteractv_Add3Test0, 0 /* unused */ }, - { TT_TEST, zInteractv_Add3Test1, 0 /* unused */ }, }; - -/* - * Fix Command Arguments for Interactv_Add3 - */ -const char* apzInteractv_Add3Patch[] = { "sed", - "-e", "/CHILD_MAX/s,/\\* Max, Max,", - "-e", "/OPEN_MAX/s,/\\* Max, Max,", - (char*)NULL }; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Io_Def_Quotes fix @@ -3087,8 +3095,8 @@ const char* apzStdio_Va_ListPatch[] = { "sh", "-c", -e 's@ va_list)@ __gnuc_va_list)@' \\\n\ -e 's@ _BSD_VA_LIST_))@ __gnuc_va_list))@' \\\n\ -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \\\n\ - -e 's@ va_list@ __va_list__@' \\\n\ - -e 's@\\*va_list@*__va_list__@' \\\n\ + -e 's@ va_list@ __not_va_list__@' \\\n\ + -e 's@\\*va_list@*__not_va_list__@' \\\n\ -e 's@ __va_list)@ __gnuc_va_list)@' \\\n\ -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \\\n\ -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \\\n\ @@ -3232,65 +3240,11 @@ const char* apzSun_MallocPatch[] = { "sed", "-e", "s/char\\([ \t]*\\*[ \t]*realloc\\)/void\\1/g", (char*)NULL }; -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Description of Sun_Memcpy fix - */ -#define SUN_MEMCPY_FIXIDX 83 -tSCC zSun_MemcpyName[] = - "Sun_Memcpy"; -/* - * File name selection pattern - */ -tSCC zSun_MemcpyList[] = - "|memory.h|"; -/* - * Machine/OS name selection pattern - */ -#define apzSun_MemcpyMachs (const char**)NULL - -/* - * content selection pattern - do fix if pattern found - */ -tSCC zSun_MemcpySelect0[] = - "/\\*\t@\\(#\\)(head/memory.h\t50.1\t |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/"; - -#define SUN_MEMCPY_TEST_CT 1 -tTestDesc aSun_MemcpyTests[] = { - { TT_EGREP, zSun_MemcpySelect0, (regex_t*)NULL }, }; - -/* - * Fix Command Arguments for Sun_Memcpy - */ -const char* apzSun_MemcpyPatch[] = { "sed", - "-e", "1i\\\n\ -/* This file was generated by fixincludes */\\\n\ -#ifndef __memory_h__\\\n\ -#define __memory_h__\\\n\ -\\\n\ -#ifdef __STDC__\\\n\ -extern void *memccpy();\\\n\ -extern void *memchr();\\\n\ -extern void *memcpy();\\\n\ -extern void *memset();\\\n\ -#else\\\n\ -extern char *memccpy();\\\n\ -extern char *memchr();\\\n\ -extern char *memcpy();\\\n\ -extern char *memset();\\\n\ -#endif /* __STDC__ */\\\n\ -\\\n\ -extern int memcmp();\\\n\ -\\\n\ -#endif /* __memory_h__ */\n", - "-e", "1,$d", - (char*)NULL }; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Sun_Rusers_Semi fix */ -#define SUN_RUSERS_SEMI_FIXIDX 84 +#define SUN_RUSERS_SEMI_FIXIDX 83 tSCC zSun_Rusers_SemiName[] = "Sun_Rusers_Semi"; /* @@ -3324,7 +3278,7 @@ const char* apzSun_Rusers_SemiPatch[] = { "sed", * * Description of Sun_Signal fix */ -#define SUN_SIGNAL_FIXIDX 85 +#define SUN_SIGNAL_FIXIDX 84 tSCC zSun_SignalName[] = "Sun_Signal"; /* @@ -3363,7 +3317,7 @@ void\t(*signal(...))(...);\\\n\ * * Description of Sun_Auth_Proto fix */ -#define SUN_AUTH_PROTO_FIXIDX 86 +#define SUN_AUTH_PROTO_FIXIDX 85 tSCC zSun_Auth_ProtoName[] = "Sun_Auth_Proto"; /* @@ -3402,7 +3356,7 @@ const char* apzSun_Auth_ProtoPatch[] = { "sed", * * Description of Sunos_Matherr_Decl fix */ -#define SUNOS_MATHERR_DECL_FIXIDX 87 +#define SUNOS_MATHERR_DECL_FIXIDX 86 tSCC zSunos_Matherr_DeclName[] = "Sunos_Matherr_Decl"; /* @@ -3438,7 +3392,7 @@ struct exception;\n", * * Description of Sunos_Strlen fix */ -#define SUNOS_STRLEN_FIXIDX 88 +#define SUNOS_STRLEN_FIXIDX 87 tSCC zSunos_StrlenName[] = "Sunos_Strlen"; /* @@ -3472,7 +3426,7 @@ const char* apzSunos_StrlenPatch[] = { "sed", * * Description of Systypes fix */ -#define SYSTYPES_FIXIDX 89 +#define SYSTYPES_FIXIDX 88 tSCC zSystypesName[] = "Systypes"; /* @@ -3530,7 +3484,7 @@ typedef __SIZE_TYPE__ size_t;\\\n\ * * Description of Systypes_For_Aix fix */ -#define SYSTYPES_FOR_AIX_FIXIDX 90 +#define SYSTYPES_FOR_AIX_FIXIDX 89 tSCC zSystypes_For_AixName[] = "Systypes_For_Aix"; /* @@ -3575,7 +3529,7 @@ const char* apzSystypes_For_AixPatch[] = { "sed", * * Description of Sysv68_String fix */ -#define SYSV68_STRING_FIXIDX 91 +#define SYSV68_STRING_FIXIDX 90 tSCC zSysv68_StringName[] = "Sysv68_String"; /* @@ -3611,7 +3565,7 @@ extern unsigned int\\\n\ * * Description of Sysz_Stdlib_For_Sun fix */ -#define SYSZ_STDLIB_FOR_SUN_FIXIDX 92 +#define SYSZ_STDLIB_FOR_SUN_FIXIDX 91 tSCC zSysz_Stdlib_For_SunName[] = "Sysz_Stdlib_For_Sun"; /* @@ -3648,7 +3602,7 @@ const char* apzSysz_Stdlib_For_SunPatch[] = { "sed", * * Description of Sysz_Stdtypes_For_Sun fix */ -#define SYSZ_STDTYPES_FOR_SUN_FIXIDX 93 +#define SYSZ_STDTYPES_FOR_SUN_FIXIDX 92 tSCC zSysz_Stdtypes_For_SunName[] = "Sysz_Stdtypes_For_Sun"; /* @@ -3688,7 +3642,7 @@ const char* apzSysz_Stdtypes_For_SunPatch[] = { "sed", * * Description of Tinfo_Cplusplus fix */ -#define TINFO_CPLUSPLUS_FIXIDX 94 +#define TINFO_CPLUSPLUS_FIXIDX 93 tSCC zTinfo_CplusplusName[] = "Tinfo_Cplusplus"; /* @@ -3718,47 +3672,11 @@ const char* apzTinfo_CplusplusPatch[] = { "sed", "-e", "s/[ \t]_cplusplus/ __cplusplus/", (char*)NULL }; -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Description of Ultrix_Ansi_Compat fix - */ -#define ULTRIX_ANSI_COMPAT_FIXIDX 95 -tSCC zUltrix_Ansi_CompatName[] = - "Ultrix_Ansi_Compat"; -/* - * File name selection pattern - */ -tSCC zUltrix_Ansi_CompatList[] = - "|ansi_compat.h|"; -/* - * Machine/OS name selection pattern - */ -#define apzUltrix_Ansi_CompatMachs (const char**)NULL - -/* - * content selection pattern - do fix if pattern found - */ -tSCC zUltrix_Ansi_CompatSelect0[] = - "ULTRIX"; - -#define ULTRIX_ANSI_COMPAT_TEST_CT 1 -tTestDesc aUltrix_Ansi_CompatTests[] = { - { TT_EGREP, zUltrix_Ansi_CompatSelect0, (regex_t*)NULL }, }; - -/* - * Fix Command Arguments for Ultrix_Ansi_Compat - */ -const char* apzUltrix_Ansi_CompatPatch[] = { "sed", - "-e", "1i\\\n\ -/* This file intentionally left blank. */\n", - "-e", "1,$d", - (char*)NULL }; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Ultrix_Fix_Fixproto fix */ -#define ULTRIX_FIX_FIXPROTO_FIXIDX 96 +#define ULTRIX_FIX_FIXPROTO_FIXIDX 94 tSCC zUltrix_Fix_FixprotoName[] = "Ultrix_Fix_Fixproto"; /* @@ -3793,7 +3711,7 @@ struct utsname;\n", * * Description of Ultrix_Atof_Param fix */ -#define ULTRIX_ATOF_PARAM_FIXIDX 97 +#define ULTRIX_ATOF_PARAM_FIXIDX 95 tSCC zUltrix_Atof_ParamName[] = "Ultrix_Atof_Param"; /* @@ -3827,7 +3745,7 @@ const char* apzUltrix_Atof_ParamPatch[] = { "sed", * * Description of Ultrix_Const fix */ -#define ULTRIX_CONST_FIXIDX 98 +#define ULTRIX_CONST_FIXIDX 96 tSCC zUltrix_ConstName[] = "Ultrix_Const"; /* @@ -3861,7 +3779,7 @@ const char* apzUltrix_ConstPatch[] = { "sed", * * Description of Ultrix_Ifdef fix */ -#define ULTRIX_IFDEF_FIXIDX 99 +#define ULTRIX_IFDEF_FIXIDX 97 tSCC zUltrix_IfdefName[] = "Ultrix_Ifdef"; /* @@ -3895,7 +3813,7 @@ const char* apzUltrix_IfdefPatch[] = { "sed", * * Description of Ultrix_Nested_Cmnt fix */ -#define ULTRIX_NESTED_CMNT_FIXIDX 100 +#define ULTRIX_NESTED_CMNT_FIXIDX 98 tSCC zUltrix_Nested_CmntName[] = "Ultrix_Nested_Cmnt"; /* @@ -3921,7 +3839,7 @@ const char* apzUltrix_Nested_CmntPatch[] = { "sed", * * Description of Ultrix_Static fix */ -#define ULTRIX_STATIC_FIXIDX 101 +#define ULTRIX_STATIC_FIXIDX 99 tSCC zUltrix_StaticName[] = "Ultrix_Static"; /* @@ -3957,7 +3875,7 @@ const char* apzUltrix_StaticPatch[] = { "sed", * * Description of Undefine_Null fix */ -#define UNDEFINE_NULL_FIXIDX 102 +#define UNDEFINE_NULL_FIXIDX 100 tSCC zUndefine_NullName[] = "Undefine_Null"; /* @@ -3998,7 +3916,7 @@ const char* apzUndefine_NullPatch[] = { "sed", * * Description of Unixware7_Byteorder_Fix fix */ -#define UNIXWARE7_BYTEORDER_FIX_FIXIDX 103 +#define UNIXWARE7_BYTEORDER_FIX_FIXIDX 101 tSCC zUnixware7_Byteorder_FixName[] = "Unixware7_Byteorder_Fix"; /* @@ -4040,7 +3958,7 @@ const char* apzUnixware7_Byteorder_FixPatch[] = { "sed", * * Description of Va_I960_Macro fix */ -#define VA_I960_MACRO_FIXIDX 104 +#define VA_I960_MACRO_FIXIDX 102 tSCC zVa_I960_MacroName[] = "Va_I960_Macro"; /* @@ -4077,7 +3995,7 @@ const char* apzVa_I960_MacroPatch[] = { "sed", * * Description of Void_Null fix */ -#define VOID_NULL_FIXIDX 105 +#define VOID_NULL_FIXIDX 103 tSCC zVoid_NullName[] = "Void_Null"; /* @@ -4111,7 +4029,7 @@ const char* apzVoid_NullPatch[] = { "sed", * * Description of Vxworks_Gcc_Problem fix */ -#define VXWORKS_GCC_PROBLEM_FIXIDX 106 +#define VXWORKS_GCC_PROBLEM_FIXIDX 104 tSCC zVxworks_Gcc_ProblemName[] = "Vxworks_Gcc_Problem"; /* @@ -4160,7 +4078,7 @@ const char* apzVxworks_Gcc_ProblemPatch[] = { "sed", * * Description of Vxworks_Needs_Vxtypes fix */ -#define VXWORKS_NEEDS_VXTYPES_FIXIDX 107 +#define VXWORKS_NEEDS_VXTYPES_FIXIDX 105 tSCC zVxworks_Needs_VxtypesName[] = "Vxworks_Needs_Vxtypes"; /* @@ -4194,7 +4112,7 @@ const char* apzVxworks_Needs_VxtypesPatch[] = { "sed", * * Description of Vxworks_Needs_Vxworks fix */ -#define VXWORKS_NEEDS_VXWORKS_FIXIDX 108 +#define VXWORKS_NEEDS_VXWORKS_FIXIDX 106 tSCC zVxworks_Needs_VxworksName[] = "Vxworks_Needs_Vxworks"; /* @@ -4242,7 +4160,7 @@ const char* apzVxworks_Needs_VxworksPatch[] = { "sed", * * Description of Vxworks_Time fix */ -#define VXWORKS_TIME_FIXIDX 109 +#define VXWORKS_TIME_FIXIDX 107 tSCC zVxworks_TimeName[] = "Vxworks_Time"; /* @@ -4292,7 +4210,7 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\\\n\ * * Description of X11_Class fix */ -#define X11_CLASS_FIXIDX 110 +#define X11_CLASS_FIXIDX 108 tSCC zX11_ClassName[] = "X11_Class"; /* @@ -4331,7 +4249,7 @@ const char* apzX11_ClassPatch[] = { "sed", * * Description of X11_Class_Usage fix */ -#define X11_CLASS_USAGE_FIXIDX 111 +#define X11_CLASS_USAGE_FIXIDX 109 tSCC zX11_Class_UsageName[] = "X11_Class_Usage"; /* @@ -4365,7 +4283,7 @@ const char* apzX11_Class_UsagePatch[] = { "sed", * * Description of X11_New fix */ -#define X11_NEW_FIXIDX 112 +#define X11_NEW_FIXIDX 110 tSCC zX11_NewName[] = "X11_New"; /* @@ -4405,20 +4323,28 @@ const char* apzX11_NewPatch[] = { "sed", * * Description of X11_Sprintf fix */ -#define X11_SPRINTF_FIXIDX 113 +#define X11_SPRINTF_FIXIDX 111 tSCC zX11_SprintfName[] = "X11_Sprintf"; /* * File name selection pattern */ tSCC zX11_SprintfList[] = - "|X11*/Xmu.h|"; + "|X11/Xmu.h|X11/Xmu/Xmu.h|"; /* * Machine/OS name selection pattern */ #define apzX11_SprintfMachs (const char**)NULL -#define X11_SPRINTF_TEST_CT 0 -#define aX11_SprintfTests (tTestDesc*)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zX11_SprintfSelect0[] = + "sprintf\\(\\)"; + +#define X11_SPRINTF_TEST_CT 1 +tTestDesc aX11_SprintfTests[] = { + { TT_EGREP, zX11_SprintfSelect0, (regex_t*)NULL }, }; /* * Fix Command Arguments for X11_Sprintf @@ -4433,9 +4359,9 @@ extern char *\tsprintf();\\\n\ * * List of all fixes */ -#define REGEX_COUNT 109 +#define REGEX_COUNT 105 #define MACH_LIST_SIZE_LIMIT 279 -#define FIX_COUNT 114 +#define FIX_COUNT 112 tFixDesc fixDescList[ FIX_COUNT ] = { { zAaa_Ki_IfaceName, zAaa_Ki_IfaceList, @@ -4488,11 +4414,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AAB_FD_ZERO_SELECTBITS_H_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, aAab_Fd_Zero_Selectbits_HTests, apzAab_Fd_Zero_Selectbits_HPatch }, + { zAab_Sun_MemcpyName, zAab_Sun_MemcpyList, + apzAab_Sun_MemcpyMachs, (regex_t*)NULL, + AAB_SUN_MEMCPY_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, + aAab_Sun_MemcpyTests, apzAab_Sun_MemcpyPatch }, + { zAab_Svr4_Replace_ByteorderName, zAab_Svr4_Replace_ByteorderList, apzAab_Svr4_Replace_ByteorderMachs, (regex_t*)NULL, AAB_SVR4_REPLACE_BYTEORDER_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, aAab_Svr4_Replace_ByteorderTests, apzAab_Svr4_Replace_ByteorderPatch }, + { zAab_Ultrix_Ansi_CompatName, zAab_Ultrix_Ansi_CompatList, + apzAab_Ultrix_Ansi_CompatMachs, (regex_t*)NULL, + AAB_ULTRIX_ANSI_COMPAT_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, + aAab_Ultrix_Ansi_CompatTests, apzAab_Ultrix_Ansi_CompatPatch }, + { zAix_SyswaitName, zAix_SyswaitList, apzAix_SyswaitMachs, (regex_t*)NULL, AIX_SYSWAIT_TEST_CT, FD_MACH_ONLY, @@ -4628,20 +4564,10 @@ tFixDesc fixDescList[ FIX_COUNT ] = { HPUX11_UINT32_C_TEST_CT, FD_MACH_ONLY, aHpux11_Uint32_CTests, apzHpux11_Uint32_CPatch }, - { zInteractv_Add1Name, zInteractv_Add1List, - apzInteractv_Add1Machs, (regex_t*)NULL, - INTERACTV_ADD1_TEST_CT, FD_MACH_ONLY, - aInteractv_Add1Tests, apzInteractv_Add1Patch }, - - { zInteractv_Add2Name, zInteractv_Add2List, - apzInteractv_Add2Machs, (regex_t*)NULL, - INTERACTV_ADD2_TEST_CT, FD_MACH_ONLY, - aInteractv_Add2Tests, apzInteractv_Add2Patch }, - - { zInteractv_Add3Name, zInteractv_Add3List, - apzInteractv_Add3Machs, (regex_t*)NULL, - INTERACTV_ADD3_TEST_CT, FD_MACH_ONLY, - aInteractv_Add3Tests, apzInteractv_Add3Patch }, + { zIsc_Omits_With_StdcName, zIsc_Omits_With_StdcList, + apzIsc_Omits_With_StdcMachs, (regex_t*)NULL, + ISC_OMITS_WITH_STDC_TEST_CT, FD_MACH_ONLY, + aIsc_Omits_With_StdcTests, apzIsc_Omits_With_StdcPatch }, { zIo_Def_QuotesName, zIo_Def_QuotesList, apzIo_Def_QuotesMachs, (regex_t*)NULL, @@ -4853,11 +4779,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { SUN_MALLOC_TEST_CT, FD_MACH_ONLY, aSun_MallocTests, apzSun_MallocPatch }, - { zSun_MemcpyName, zSun_MemcpyList, - apzSun_MemcpyMachs, (regex_t*)NULL, - SUN_MEMCPY_TEST_CT, FD_MACH_ONLY, - aSun_MemcpyTests, apzSun_MemcpyPatch }, - { zSun_Rusers_SemiName, zSun_Rusers_SemiList, apzSun_Rusers_SemiMachs, (regex_t*)NULL, SUN_RUSERS_SEMI_TEST_CT, FD_MACH_ONLY, @@ -4913,11 +4834,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { TINFO_CPLUSPLUS_TEST_CT, FD_MACH_ONLY, aTinfo_CplusplusTests, apzTinfo_CplusplusPatch }, - { zUltrix_Ansi_CompatName, zUltrix_Ansi_CompatList, - apzUltrix_Ansi_CompatMachs, (regex_t*)NULL, - ULTRIX_ANSI_COMPAT_TEST_CT, FD_MACH_ONLY, - aUltrix_Ansi_CompatTests, apzUltrix_Ansi_CompatPatch }, - { zUltrix_Fix_FixprotoName, zUltrix_Fix_FixprotoList, apzUltrix_Fix_FixprotoMachs, (regex_t*)NULL, ULTRIX_FIX_FIXPROTO_TEST_CT, FD_MACH_ONLY, diff --git a/gcc/fixinc/fixlib.c b/gcc/fixinc/fixlib.c index e5319b9622a..190f49db03f 100644 --- a/gcc/fixinc/fixlib.c +++ b/gcc/fixinc/fixlib.c @@ -1,4 +1,27 @@ +/* Install modified versions of certain ANSI-incompatible system header + files which are fixed to work correctly with ANSI C and placed in a + directory that GNU C will search. + + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + #include "fixlib.h" /* * * * * * * * * * * * * @@ -128,3 +151,39 @@ is_cxx_header (fname, text) return BOOL_FALSE; } + +/* * * * * * * * * * * * * + + Compile one regular expression pattern for later use. PAT contains + the pattern, RE points to a regex_t structure (which should have + been bzeroed). MATCH is 1 if we need to know where the regex + matched, 0 if not. If regcomp fails, prints an error message and + aborts; E1 and E2 are strings to shove into the error message. + + The patterns we search for are all egrep patterns. + REG_EXTENDED|REG_NEWLINE produces identical regex syntax/semantics + to egrep (verified from 4.4BSD Programmer's Reference Manual). */ +void +compile_re( pat, re, match, e1, e2 ) + tCC *pat; + regex_t *re; + int match; + tCC *e1; + tCC *e2; +{ + tSCC z_bad_comp[] = "fixincl ERROR: cannot compile %s regex for %s\n\ +\texpr = `%s'\n\terror %s\n"; + int flags, err; + + flags = (match ? REG_EXTENDED|REG_NEWLINE + : REG_EXTENDED|REG_NEWLINE|REG_NOSUB); + err = regcomp (re, pat, flags); + + if (err) + { + char rerrbuf[1024]; + regerror (err, re, rerrbuf, 1024); + fprintf (stderr, z_bad_comp, e1, e2, pat, rerrbuf); + exit (EXIT_FAILURE); + } +} diff --git a/gcc/fixinc/fixlib.h b/gcc/fixinc/fixlib.h index 098bb0019aa..76cb3a9ecef 100644 --- a/gcc/fixinc/fixlib.h +++ b/gcc/fixinc/fixlib.h @@ -3,7 +3,7 @@ files which are fixed to work correctly with ANSI C and placed in a directory that GNU C will search. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. @@ -97,5 +97,6 @@ typedef int apply_fix_p_t; /* Apply Fix Predicate Type */ */ char * load_file_data _P_(( FILE* fp )); t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext )); - +void compile_re _P_(( tCC* pat, regex_t* re, int match, + tCC *e1, tCC *e2 )); #endif /* FIXINCLUDES_FIXLIB_H */ diff --git a/gcc/fixinc/fixtests.c b/gcc/fixinc/fixtests.c index 45eb4ef73e5..941b1ee1815 100644 --- a/gcc/fixinc/fixtests.c +++ b/gcc/fixinc/fixtests.c @@ -3,7 +3,7 @@ Test to see if a particular fix should be applied to a header file. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. = = = = = = = = = = = = = = = = = = = = = = = = = @@ -164,9 +164,8 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test ) if (! compiled) { compiled++; - re_set_syntax (RE_SYNTAX_EGREP); - (void)re_compile_pattern (label_pat, sizeof (label_pat)-1, - &label_re); + compile_re (label_pat, &label_re, 1, + "label pattern", "else_endif_label_test"); } for (;;) /* entire file */ diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def index d83ac73386f..d26c7d718d4 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -282,6 +282,45 @@ fix = { }; +/* + * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin + * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because + * many other systems have similar text but correct versions of the file. + * To ensure only Sun's is fixed, we grep for a likely unique string. + * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t ) + */ +fix = { + hackname = AAB_sun_memcpy; + files = memory.h; + select = "/\\*\t@\\(#\\)" + "(head/memory.h\t50.1\t " + "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/"; + + replace = +'/* This file was generated by fixincludes */ +\#ifndef __memory_h__ +\#define __memory_h__ + +\#ifdef __STDC__ +extern void *memccpy(); +extern void *memchr(); +extern void *memcpy(); +extern void *memset(); +\#else +extern char *memccpy(); +extern char *memchr(); +extern char *memcpy(); +extern char *memset(); +\#endif /* __STDC__ */ + +extern int memcmp(); + +\#endif /* __memory_h__ */ +'; + +}; + + /* * Completely replace ; with a file that implements gcc's * optimized byteswapping. Restricted to "SVR4" machines until either @@ -468,6 +507,17 @@ fix = { #endif +/* + * Cancel out ansi_compat.h on Ultrix. Replace it with an empty file. + */ +fix = { + hackname = AAB_ultrix_ansi_compat; + files = ansi_compat.h; + select = ULTRIX; + replace = "/* This file intentionally left blank. */\n"; +}; + + /* * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition * of struct rusage, so the prototype (added by fixproto) causes havoc. @@ -898,18 +948,13 @@ fix = { }; /* - * Determine if we're on Interactive Unix 2.2 or later, in which case we - * need to fix some additional files. This is the same test for ISC that - * Autoconf uses. On Interactive 2.2, certain traditional Unix - * definitions (notably getc and putc in stdio.h) are omitted if __STDC__ - * is defined, not just if _POSIX_SOURCE is defined. This makes it + * On Interactive Unix 2.2, certain traditional Unix definitions + * (notably getc and putc in stdio.h) are omitted if __STDC__ is + * defined, not just if _POSIX_SOURCE is defined. This makes it * impossible to compile any nontrivial program except with -posix. */ fix = { - hackname = interactv_add1; - - test = " -d /etc/conf/kconfig.d"; - test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"'; + hackname = isc_omits_with_stdc; files = "stdio.h"; files = "math.h"; @@ -918,33 +963,12 @@ fix = { files = "sys/fcntl.h"; files = "sys/dirent.h"; + select = "defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)"; + sed = "s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/" "!defined(_POSIX_SOURCE)/"; }; -fix = { - hackname = interactv_add2; - - test = " -d /etc/conf/kconfig.d"; - test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"'; - - files = math.h; - sed = "s/fmod(double)/fmod(double, double)/"; -}; - -fix = { - hackname = interactv_add3; - - test = " -d /etc/conf/kconfig.d"; - test = ' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`"'; - - files = sys/limits.h; - - sed = "/CHILD_MAX/s,/\\* Max, Max,"; - sed = "/OPEN_MAX/s,/\\* Max, Max,"; -}; - - /* * Fix various _IO* defines, but do *not* quote the characters cgxtf. */ @@ -1837,41 +1861,6 @@ fix = { }; -/* - * Fix non-ANSI memcpy declaration that conflicts with gcc's builtin - * declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because - * many other systems have similar text but correct versions of the file. - * To ensure only Sun's is fixed, we grep for a likely unique string. - * Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t ) - */ -fix = { - hackname = sun_memcpy; - files = memory.h; - select = "/\\*\t@\\(#\\)" - "(head/memory.h\t50.1\t " - "|memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2\t)\\*/"; - - sed = "1i\\\n/* This file was generated by fixincludes */\\\n" - "#ifndef __memory_h__\\\n" - "#define __memory_h__\\\n\\\n" - "#ifdef __STDC__\\\n" - "extern void *memccpy();\\\n" - "extern void *memchr();\\\n" - "extern void *memcpy();\\\n" - "extern void *memset();\\\n" - "#else\\\n" - "extern char *memccpy();\\\n" - "extern char *memchr();\\\n" - "extern char *memcpy();\\\n" - "extern char *memset();\\\n" - "#endif /* __STDC__ */\\\n\\\n" - "extern int memcmp();\\\n\\\n" - "#endif /* __memory_h__ */\n"; - - sed = "1,$d"; -}; - - /* * Check for yet more missing ';' in struct (in SunOS 4.0.x) */ @@ -2455,18 +2444,6 @@ fix = { }; -/* - * Cancel out ansi_compat.h on Ultrix. Replace it with empty file. - */ -fix = { - hackname = ultrix_ansi_compat; - files = ansi_compat.h; - select = ULTRIX; - sed = "1i\\\n/* This file intentionally left blank. */\n"; - sed = "1,$d"; -}; - - /* * Ultrix V4.[35] puts the declaration of uname before the definition * of struct utsname, so the prototype (added by fixproto) causes havoc. @@ -2758,7 +2735,10 @@ fix = { */ fix = { hackname = x11_sprintf; - files = X11*/Xmu.h; + files = X11/Xmu.h; + files = X11/Xmu/Xmu.h; + select = 'sprintf\(\)'; + sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n" "extern char *\tsprintf();\\\n" "#endif /* !defined __STDC__ */,"; diff --git a/gcc/fixinc/inclhack.sh b/gcc/fixinc/inclhack.sh index 29b255461b2..b3a3386716c 100755 --- a/gcc/fixinc/inclhack.sh +++ b/gcc/fixinc/inclhack.sh @@ -6,11 +6,11 @@ # files which are fixed to work correctly with ANSI C and placed in a # directory that GNU C will search. # -# This script contains 114 fixup scripts. +# This script contains 112 fixup scripts. # # See README-fixinc for more information. # -# fixincludes copyright (c) 1999 The Free Software Foundation, Inc. +# fixincludes copyright (c) 2000 The Free Software Foundation, Inc. # # fixincludes is free software. # @@ -658,6 +658,42 @@ _EOF_ esac + # + # Fix Aab_Sun_Memcpy + # + case "${file}" in ./memory.h ) + if ( test -n "`egrep '/\\* @\\(#\\)(head/memory.h 50.1 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2 )\\*/' ${file}`" + ) > /dev/null 2>&1 ; then + echo "AAB_sun_memcpy replacing file ${file}" >&2 + cat > ${DESTFILE} << '_EOF_' +/* This file was generated by fixincludes */ +#ifndef __memory_h__ +#define __memory_h__ + +#ifdef __STDC__ +extern void *memccpy(); +extern void *memchr(); +extern void *memcpy(); +extern void *memset(); +#else +extern char *memccpy(); +extern char *memchr(); +extern char *memcpy(); +extern char *memset(); +#endif /* __STDC__ */ + +extern int memcmp(); + +#endif /* __memory_h__ */ + +_EOF_ + continue + + fi # end of select 'if' + ;; # case end for file name test + esac + + # # Fix Aab_Svr4_Replace_Byteorder # @@ -823,6 +859,24 @@ _EOF_ esac + # + # Fix Aab_Ultrix_Ansi_Compat + # + case "${file}" in ./ansi_compat.h ) + if ( test -n "`egrep 'ULTRIX' ${file}`" + ) > /dev/null 2>&1 ; then + echo "AAB_ultrix_ansi_compat replacing file ${file}" >&2 + cat > ${DESTFILE} << '_EOF_' +/* This file intentionally left blank. */ + +_EOF_ + continue + + fi # end of select 'if' + ;; # case end for file name test + esac + + # # Fix Aix_Syswait # @@ -1461,7 +1515,7 @@ extern "C" {\ # - # Fix Interactv_Add1 + # Fix Isc_Omits_With_Stdc # case "${file}" in ./stdio.h | \ ./math.h | \ @@ -1469,11 +1523,10 @@ extern "C" {\ ./sys/limits.h | \ ./sys/fcntl.h | \ ./sys/dirent.h ) - if ( test '(' -d /etc/conf/kconfig.d ')' -a \ - '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')' + if ( test -n "`egrep 'defined(__STDC__) && !defined(_POSIX_SOURCE)' ${file}`" ) > /dev/null 2>&1 ; then fixlist="${fixlist} - interactv_add1" + isc_omits_with_stdc" if [ ! -r ${DESTFILE} ] then infile=${file} else infile=${DESTFILE} ; fi @@ -1482,52 +1535,7 @@ extern "C" {\ < $infile > ${DESTDIR}/fixinc.tmp rm -f ${DESTFILE} mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} - fi # end of test expression 'if' - ;; # case end for file name test - esac - - - # - # Fix Interactv_Add2 - # - case "${file}" in ./math.h ) - if ( test '(' -d /etc/conf/kconfig.d ')' -a \ - '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')' - ) > /dev/null 2>&1 ; then - fixlist="${fixlist} - interactv_add2" - if [ ! -r ${DESTFILE} ] - then infile=${file} - else infile=${DESTFILE} ; fi - - sed -e 's/fmod(double)/fmod(double, double)/' \ - < $infile > ${DESTDIR}/fixinc.tmp - rm -f ${DESTFILE} - mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} - fi # end of test expression 'if' - ;; # case end for file name test - esac - - - # - # Fix Interactv_Add3 - # - case "${file}" in ./sys/limits.h ) - if ( test '(' -d /etc/conf/kconfig.d ')' -a \ - '(' -n "`grep _POSIX_VERSION /usr/include/sys/unistd.h`" ')' - ) > /dev/null 2>&1 ; then - fixlist="${fixlist} - interactv_add3" - if [ ! -r ${DESTFILE} ] - then infile=${file} - else infile=${DESTFILE} ; fi - - sed -e '/CHILD_MAX/s,/\* Max, Max,' \ - -e '/OPEN_MAX/s,/\* Max, Max,' \ - < $infile > ${DESTDIR}/fixinc.tmp - rm -f ${DESTFILE} - mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} - fi # end of test expression 'if' + fi # end of select 'if' ;; # case end for file name test esac @@ -2616,48 +2624,6 @@ typedef __regmatch_t regmatch_t; esac - # - # Fix Sun_Memcpy - # - case "${file}" in ./memory.h ) - if ( test -n "`egrep '/\\* @\\(#\\)(head/memory.h 50.1 |memory\\.h 1\\.[2-4] 8./../.. SMI; from S5R2 1\\.2 )\\*/' ${file}`" - ) > /dev/null 2>&1 ; then - fixlist="${fixlist} - sun_memcpy" - if [ ! -r ${DESTFILE} ] - then infile=${file} - else infile=${DESTFILE} ; fi - - sed -e '1i\ -/* This file was generated by fixincludes */\ -#ifndef __memory_h__\ -#define __memory_h__\ -\ -#ifdef __STDC__\ -extern void *memccpy();\ -extern void *memchr();\ -extern void *memcpy();\ -extern void *memset();\ -#else\ -extern char *memccpy();\ -extern char *memchr();\ -extern char *memcpy();\ -extern char *memset();\ -#endif /* __STDC__ */\ -\ -extern int memcmp();\ -\ -#endif /* __memory_h__ */ -' \ - -e '1,$d' \ - < $infile > ${DESTDIR}/fixinc.tmp - rm -f ${DESTFILE} - mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} - fi # end of select 'if' - ;; # case end for file name test - esac - - # # Fix Sun_Rusers_Semi # @@ -2984,30 +2950,6 @@ extern unsigned int\ esac - # - # Fix Ultrix_Ansi_Compat - # - case "${file}" in ./ansi_compat.h ) - if ( test -n "`egrep 'ULTRIX' ${file}`" - ) > /dev/null 2>&1 ; then - fixlist="${fixlist} - ultrix_ansi_compat" - if [ ! -r ${DESTFILE} ] - then infile=${file} - else infile=${DESTFILE} ; fi - - sed -e '1i\ -/* This file intentionally left blank. */ -' \ - -e '1,$d' \ - < $infile > ${DESTDIR}/fixinc.tmp - rm -f ${DESTFILE} - mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} - fi # end of select 'if' - ;; # case end for file name test - esac - - # # Fix Ultrix_Fix_Fixproto # @@ -3454,7 +3396,10 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\ # # Fix X11_Sprintf # - case "${file}" in ./X11*/Xmu.h ) + case "${file}" in ./X11/Xmu.h | \ + ./X11/Xmu/Xmu.h ) + if ( test -n "`egrep 'sprintf\\(\\)' ${file}`" + ) > /dev/null 2>&1 ; then fixlist="${fixlist} x11_sprintf" if [ ! -r ${DESTFILE} ] @@ -3467,6 +3412,7 @@ extern char * sprintf();\ < $infile > ${DESTDIR}/fixinc.tmp rm -f ${DESTFILE} mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE} + fi # end of select 'if' ;; # case end for file name test esac # IF the output has been removed OR it is unchanged, -- 2.30.2