From 7e41654136975b1ee18cc8e7c97e16e9f6206452 Mon Sep 17 00:00:00 2001 From: Bruce Korb Date: Mon, 29 Oct 2012 16:44:34 +0000 Subject: Omit testing wrap and replacement fixes during testing. This exposes a missing result and tests a test that got hidden before. From-SVN: r192952 --- fixincludes/ChangeLog | 15 + fixincludes/README | 3 + fixincludes/check.tpl | 1 + fixincludes/fixincl.c | 27 +- fixincludes/fixincl.x | 511 ++++++++++++++++++++++--- fixincludes/fixlib.h | 26 +- fixincludes/fixopts.c | 42 +- fixincludes/fixtests.c | 2 +- fixincludes/inclhack.def | 45 ++- fixincludes/tests/base/architecture/ppc/math.h | 84 +--- fixincludes/tests/base/ioLib.h | 19 + 11 files changed, 592 insertions(+), 183 deletions(-) create mode 100644 fixincludes/tests/base/ioLib.h (limited to 'fixincludes') diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index b41671093b8..ffd62de300b 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,18 @@ +2012-09-29 Bruce Korb + + * README: testing wrap and replacement fixes is pointless. + * fixincl.c: export verbosity enumerations to fixlib.h + (run_compiles): mark replacement fixes to be skipped when + in testing mode + * fixlib.h: add a test mode and enumerations from fixincl.c + * check.tpl: set TEST_MODE in environment + * fixopts.c (initialize_opts): check for TEST_MODE in environment + * inclhack.def: move AAB_darwin7_9_long_double_funcs to + darwin_9_long_double_funcs_2. It is not a replacement fix. + * fixincl.x: regenerate + * tests/base/ioLib.h: the need for this is now exposed, so add it. + * tests/base/architecture/ppc/math.h: the correct result is now needed. + 2012-09-29 Robert Mason * fixinc.in: Omit machine name checks for vxworks diff --git a/fixincludes/README b/fixincludes/README index c7144a0ba29..9b482102b28 100644 --- a/fixincludes/README +++ b/fixincludes/README @@ -44,6 +44,9 @@ To make your fix, you will need to do several things: Make sure it is now properly handled. Add tests to the "test_text" entry(ies) that validate your fix. This will help ensure that future fixes won't negate your work. + Do *NOT* specify test text for "wrap" or "replacement" fixes. + There is no real possibility that these fixes will fail. + If they do, you will surely know straight away. 5. Go into the fixincludes build directory and type, "make check". You are guaranteed to have issues printed out as a result. diff --git a/fixincludes/check.tpl b/fixincludes/check.tpl index a9810e28a8f..0d1f44431fc 100644 --- a/fixincludes/check.tpl +++ b/fixincludes/check.tpl @@ -99,6 +99,7 @@ ENDFOR fix =] +export TEST_MODE=true find . -type f | sed 's;^\./;;' | sort | ../../fixincl cd ${DESTDIR} diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c index 1133534202b..fecfb19e1b1 100644 --- a/fixincludes/fixincl.c +++ b/fixincludes/fixincl.c @@ -53,22 +53,8 @@ static const char z_std_preamble[] = original, manufacturer supplied header file. */\n\n"; int find_base_len = 0; - -typedef enum { - VERB_SILENT = 0, - VERB_FIXES, - VERB_APPLIES, - VERB_PROGRESS, - VERB_TESTS, - VERB_EVERYTHING -} te_verbose; - -te_verbose verbose_level = VERB_PROGRESS; int have_tty = 0; -#define VLEVEL(l) ((unsigned int) verbose_level >= (unsigned int) l) -#define NOT_SILENT VLEVEL(VERB_FIXES) - pid_t process_chain_head = (pid_t) -1; char* pz_curr_file; /* name of the current file under test/fix */ @@ -412,8 +398,17 @@ run_compiles (void) /* FOR every fixup, ... */ do { - tTestDesc *p_test = p_fixd->p_test_desc; - int test_ct = p_fixd->test_ct; + tTestDesc *p_test; + int test_ct; + + if (fixinc_mode && (p_fixd->fd_flags & FD_REPLACEMENT)) + { + p_fixd->fd_flags |= FD_SKIP_TEST; + continue; + } + + p_test = p_fixd->p_test_desc; + test_ct = p_fixd->test_ct; /* IF the machine type pointer is not NULL (we are not in test mode) AND this test is for or not done on particular machines diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 50a553fa125..4115772acab 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Saturday September 29, 2012 at 01:58:03 PM PDT + * It has been AutoGen-ed October 28, 2012 at 02:53:25 PM by AutoGen 5.17.0pre5 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Sep 29 13:58:03 PDT 2012 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Oct 28 14:53:25 PDT 2012 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * 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. * - * This file contains 216 fixup descriptions. + * This file contains 224 fixup descriptions. * * See README for more information. * @@ -267,44 +267,6 @@ static const char* apzAab_Darwin7_9_Long_Double_FuncsPatch[] = { #endif /* __MATH__ */", (char*)NULL }; -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Description of Aab_Darwin7_9_Long_Double_Funcs_2 fix - */ -tSCC zAab_Darwin7_9_Long_Double_Funcs_2Name[] = - "AAB_darwin7_9_long_double_funcs_2"; - -/* - * File name selection pattern - */ -tSCC zAab_Darwin7_9_Long_Double_Funcs_2List[] = - "math.h\0"; -/* - * Machine/OS name selection pattern - */ -tSCC* apzAab_Darwin7_9_Long_Double_Funcs_2Machs[] = { - "*-*-darwin7.9*", - (const char*)NULL }; - -/* - * content selection pattern - do fix if pattern found - */ -tSCC zAab_Darwin7_9_Long_Double_Funcs_2Select0[] = - "#include[ \\t]+\\\""; - -#define AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_2_TEST_CT 1 -static tTestDesc aAab_Darwin7_9_Long_Double_Funcs_2Tests[] = { - { TT_EGREP, zAab_Darwin7_9_Long_Double_Funcs_2Select0, (regex_t*)NULL }, }; - -/* - * Fix Command Arguments for Aab_Darwin7_9_Long_Double_Funcs_2 - */ -static const char* apzAab_Darwin7_9_Long_Double_Funcs_2Patch[] = { - "format", - "%1<%2.h>", - "([ \\t]*#[ \\t]*include[ \\t]+)\"([a-z0-9/]+)\\.h\"", - (char*)NULL }; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aab_Fd_Zero_Asm_Posix_Types_H fix @@ -537,6 +499,241 @@ static const char* apzAab_Sun_MemcpyPatch[] = { #endif /* __memory_h__ */", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aab_Vxworks_Assert fix + */ +tSCC zAab_Vxworks_AssertName[] = + "AAB_vxworks_assert"; + +/* + * File name selection pattern + */ +tSCC zAab_Vxworks_AssertList[] = + "assert.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAab_Vxworks_AssertMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; +#define AAB_VXWORKS_ASSERT_TEST_CT 0 +#define aAab_Vxworks_AssertTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Aab_Vxworks_Assert + */ +static const char* apzAab_Vxworks_AssertPatch[] = { +"#ifndef _ASSERT_H\n\ +#define _ASSERT_H\n\n\ +#ifdef assert\n\ +#undef assert\n\ +#endif\n\n\ +#if defined(__STDC__) || defined(__cplusplus)\n\ +extern void __assert (const char*);\n\ +#else\n\ +extern void __assert ();\n\ +#endif\n\n\ +#ifdef NDEBUG\n\ +#define assert(ign) ((void)0)\n\ +#else\n\n\ +#define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)\n\ +#define ASSERT_STRINGIFY_HELPER(str) #str\n\n\ +#define assert(test) ((void) \\\n\ + ((test) ? ((void)0) : \\\n\ + __assert(\"Assertion failed: \" ASSERT_STRINGIFY(test) \", file \" \\\n\ + __FILE__ \", line \" ASSERT_STRINGIFY(__LINE__) \"\\n\")))\n\n\ +#endif\n\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aab_Vxworks_Regs_Vxtypes fix + */ +tSCC zAab_Vxworks_Regs_VxtypesName[] = + "AAB_vxworks_regs_vxtypes"; + +/* + * File name selection pattern + */ +tSCC zAab_Vxworks_Regs_VxtypesList[] = + "regs.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAab_Vxworks_Regs_VxtypesMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; +#define AAB_VXWORKS_REGS_VXTYPES_TEST_CT 0 +#define aAab_Vxworks_Regs_VxtypesTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Aab_Vxworks_Regs_Vxtypes + */ +static const char* apzAab_Vxworks_Regs_VxtypesPatch[] = { +"#ifndef _REGS_H\n\ +#define _REGS_H\n\ +#include \n\ +#include_next \n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aab_Vxworks_Stdint fix + */ +tSCC zAab_Vxworks_StdintName[] = + "AAB_vxworks_stdint"; + +/* + * File name selection pattern + */ +tSCC zAab_Vxworks_StdintList[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAab_Vxworks_StdintMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; +#define AAB_VXWORKS_STDINT_TEST_CT 0 +#define aAab_Vxworks_StdintTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Aab_Vxworks_Stdint + */ +static const char* apzAab_Vxworks_StdintPatch[] = { +"#ifndef _STDINT_H\n\ +#define _STDINT_H\n\ +/* get int*_t, uint*_t */\n\ +#include \n\n\ +/* get legacy vxworks types for compatibility */\n\ +#include \n\n\ +typedef long intptr_t;\n\ +typedef unsigned long uintptr_t;\n\n\ +typedef int64_t intmax_t;\n\ +typedef uint64_t uintmax_t;\n\n\ +typedef int8_t int_least8_t;\n\ +typedef int16_t int_least16_t;\n\ +typedef int32_t int_least32_t;\n\ +typedef int64_t int_least64_t;\n\n\ +typedef uint8_t uint_least8_t;\n\ +typedef uint16_t uint_least16_t;\n\ +typedef uint32_t uint_least32_t;\n\ +typedef uint64_t uint_least64_t;\n\n\ +typedef int8_t int_fast8_t;\n\ +typedef int int_fast16_t;\n\ +typedef int32_t int_fast32_t;\n\ +typedef int64_t int_fast64_t;\n\n\ +typedef uint8_t uint_fast8_t;\n\ +typedef unsigned int uint_fast16_t;\n\ +typedef uint32_t uint_fast32_t;\n\ +typedef uint64_t uint_fast64_t;\n\n\ +/* Ranges */\n\ +#define UINT8_MAX (~(uint8_t)0)\n\ +#define UINT8_MIN 0\n\ +#define UINT16_MAX (~(uint16_t)0)\n\ +#define UINT16_MIN 0\n\ +#define UINT32_MAX (~(uint32_t)0)\n\ +#define UINT32_MIN 0\n\ +#define UINT64_MAX (~(uint64_t)0)\n\ +#define UINT64_MIN 0\n\n\ +#define UINTPTR_MAX (~(uintptr_t)0)\n\ +#define UINTPTR_MIN 0\n\n\ +/* Need to do int_fast16_t as well, as type\n\ + size may be architecture dependent */\n\ +#define UINT_FAST16_MAX (~(uint_fast16_t)0)\n\ +#define UINT_FAST16_MAX 0\n\n\ +#define INT8_MAX (UINT8_MAX>>1)\n\ +#define INT8_MIN (INT8_MAX+1)\n\ +#define INT16_MAX (UINT16_MAX>>1)\n\ +#define INT16_MIN (INT16_MAX+1)\n\ +#define INT32_MAX (UINT32_MAX>>1)\n\ +#define INT32_MIN (INT32_MAX+1)\n\ +#define INT64_MAX (UINT64_MAX>>1)\n\ +#define INT64_MIN (INT64_MAX+1)\n\n\ +#define INTPTR_MAX (UINTPTR_MAX>>1)\n\ +#define INTPTR_MIN (INTPTR_MAX+1)\t\n\n\ +#define INT_FAST16_MAX (UINT_FAST16_MAX>>1)\n\ +#define INT_FAST16_MIN (INT_FAST16_MAX+1)\n\n\ +/* now define equiv. constants */\n\ +#define UINT_FAST8_MAX UINT8_MAX\n\ +#define UINT_FAST8_MIN UINT_FAST8_MIN\n\ +#define INT_FAST8_MAX INT8_MAX\n\ +#define INT_FAST8_MIN INT8_MIN\n\ +#define UINT_FAST32_MAX UINT32_MAX\n\ +#define UINT_FAST32_MIN UINT32_MIN\n\ +#define INT_FAST32_MAX INT32_MAX\n\ +#define INT_FAST32_MIN INT32_MIN\n\ +#define UINT_FAST64_MAX UINT64_MAX\n\ +#define UINT_FAST64_MIN UINT64_MIN\n\ +#define INT_FAST64_MAX INT64_MAX\n\ +#define INT_FAST64_MIN INT64_MIN\n\n\ +#define UINT_LEAST8_MAX UINT8_MAX\n\ +#define UINT_LEAST8_MIN UINT8_MIN\n\ +#define INT_LEAST8_MAX INT8_MAX\n\ +#define INT_LEAST8_MIN INT8_MIN\n\ +#define UINT_LEAST16_MAX UINT16_MAX\n\ +#define UINT_LEAST16_MIN UINT16_MIN\n\ +#define INT_LEAST16_MAX INT16_MAX\n\ +#define INT_LEAST16_MIN INT16_MIN\n\ +#define UINT_LEAST32_MAX UINT32_MAX\n\ +#define UINT_LEAST32_MIN UINT32_MIN\n\ +#define INT_LEAST32_MAX INT32_MAX\n\ +#define INT_LEAST32_MIN INT32_MIN\n\ +#define UINT_LEAST64_MAX UINT64_MAX\n\ +#define UINT_LEAST64_MIN UINT64_MIN\n\ +#define INT_LEAST64_MAX INT64_MAX\n\ +#define INT_LEAST64_MIN INT64_MIN\n\n\ +#define UINTMAX_MAX UINT64_MAX\n\ +#define UINTMAX_MIN UINT64_MIN\n\ +#define INTMAX_MAX INT64_MAX\n\ +#define INTMAX_MIN INT64_MIN\n\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aab_Vxworks_Unistd fix + */ +tSCC zAab_Vxworks_UnistdName[] = + "AAB_vxworks_unistd"; + +/* + * File name selection pattern + */ +tSCC zAab_Vxworks_UnistdList[] = + "unistd.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAab_Vxworks_UnistdMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; +#define AAB_VXWORKS_UNISTD_TEST_CT 0 +#define aAab_Vxworks_UnistdTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Aab_Vxworks_Unistd + */ +static const char* apzAab_Vxworks_UnistdPatch[] = { +"#ifndef _UNISTD_H\n\ +#define _UNISTD_H\n\ +#include_next \n\ +#include \n\ +#ifndef STDIN_FILENO\n\ +#define STDIN_FILENO 0\n\ +#endif\n\ +#ifndef STDOUT_FILENO\n\ +#define STDOUT_FILENO 1\n\ +#endif\n\ +#ifndef STDERR_FILENO\n\ +#define STDERR_FILENO 2\n\ +#endif\n\ +#endif /* _UNISTD_H */", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Complex fix @@ -1758,7 +1955,7 @@ tSCC zBroken_NanList[] = * content selection pattern - do fix if pattern found */ tSCC zBroken_NanSelect0[] = - "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)"; + "#if defined\\(__APPLE_CC__\\) && \\(__APPLE_CC__ >= 1345\\)"; /* * content bypass pattern - skip fix if pattern found @@ -1969,6 +2166,44 @@ extern \"C\" {\n\ #endif\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_9_Long_Double_Funcs_2 fix + */ +tSCC zDarwin_9_Long_Double_Funcs_2Name[] = + "darwin_9_long_double_funcs_2"; + +/* + * File name selection pattern + */ +tSCC zDarwin_9_Long_Double_Funcs_2List[] = + "math.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_9_Long_Double_Funcs_2Machs[] = { + "*-*-darwin7.9*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_9_Long_Double_Funcs_2Select0[] = + "#include[ \\t]+\\\""; + +#define DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT 1 +static tTestDesc aDarwin_9_Long_Double_Funcs_2Tests[] = { + { TT_EGREP, zDarwin_9_Long_Double_Funcs_2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_9_Long_Double_Funcs_2 + */ +static const char* apzDarwin_9_Long_Double_Funcs_2Patch[] = { + "format", + "%1<%2.h>", + "([ \\t]*#[ \\t]*include[ \\t]+)\"([a-z0-9/]+)\\.h\"", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Darwin_Externc fix @@ -8497,6 +8732,68 @@ static const char* apzVxworks_Gcc_ProblemPatch[] = { sed_cmd_z, #endif\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Vxworks_Ioctl_Macro fix + */ +tSCC zVxworks_Ioctl_MacroName[] = + "vxworks_ioctl_macro"; + +/* + * File name selection pattern + */ +tSCC zVxworks_Ioctl_MacroList[] = + "ioLib.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzVxworks_Ioctl_MacroMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; +#define VXWORKS_IOCTL_MACRO_TEST_CT 0 +#define aVxworks_Ioctl_MacroTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Vxworks_Ioctl_Macro + */ +static const char* apzVxworks_Ioctl_MacroPatch[] = { + "format", + "%0\n\ +#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n", + "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Vxworks_Mkdir_Macro fix + */ +tSCC zVxworks_Mkdir_MacroName[] = + "vxworks_mkdir_macro"; + +/* + * File name selection pattern + */ +tSCC zVxworks_Mkdir_MacroList[] = + "sys/stat.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzVxworks_Mkdir_MacroMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; +#define VXWORKS_MKDIR_MACRO_TEST_CT 0 +#define aVxworks_Mkdir_MacroTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Vxworks_Mkdir_Macro + */ +static const char* apzVxworks_Mkdir_MacroPatch[] = { + "format", + "%0\n\ +#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n", + "extern[\t ]+STATUS[\t ]+mkdir[\t ]*\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*(|[_[:alpha:]][_[:alnum:]]*)\\)[\t ]*;", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Vxworks_Needs_Vxtypes fix @@ -8580,6 +8877,42 @@ static const char* apzVxworks_Needs_VxworksPatch[] = { sed_cmd_z, #include \n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Vxworks_Regs fix + */ +tSCC zVxworks_RegsName[] = + "vxworks_regs"; + +/* + * File name selection pattern + */ +#define zVxworks_RegsList (char*)NULL +/* + * Machine/OS name selection pattern + */ +tSCC* apzVxworks_RegsMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zVxworks_RegsSelect0[] = + "#[\t ]*include[\t ]+[<\"]regs.h[>\"]"; + +#define VXWORKS_REGS_TEST_CT 1 +static tTestDesc aVxworks_RegsTests[] = { + { TT_EGREP, zVxworks_RegsSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Vxworks_Regs + */ +static const char* apzVxworks_RegsPatch[] = { + "format", + "#include ", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Vxworks_Time fix @@ -8630,6 +8963,36 @@ typedef void (*__gcc_VOIDFUNCPTR) ();\n\ #define VOIDFUNCPTR __gcc_VOIDFUNCPTR", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Vxworks_Write_Const fix + */ +tSCC zVxworks_Write_ConstName[] = + "vxworks_write_const"; + +/* + * File name selection pattern + */ +tSCC zVxworks_Write_ConstList[] = + "ioLib.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzVxworks_Write_ConstMachs[] = { + "*-*-vxworks*", + (const char*)NULL }; +#define VXWORKS_WRITE_CONST_TEST_CT 0 +#define aVxworks_Write_ConstTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Vxworks_Write_Const + */ +static const char* apzVxworks_Write_ConstPatch[] = { + "format", + "extern int write (int, const char*, size_t);", + "extern[\t ]+int[\t ]+write[\t ]*\\([\t ]*int[\t ]*,[\t ]*char[\t ]*\\*[\t ]*,[\t ]*size_t[\t ]*\\)[\t ]*;", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of X11_Class fix @@ -8800,9 +9163,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 259 +#define REGEX_COUNT 260 #define MACH_LIST_SIZE_LIMIT 181 -#define FIX_COUNT 216 +#define FIX_COUNT 224 /* * Enumerate the fixes @@ -8811,12 +9174,15 @@ typedef enum { AAB_AIX_STDIO_FIXIDX, AAB_AIX_FCNTL_FIXIDX, AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_FIXIDX, - AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_2_FIXIDX, AAB_FD_ZERO_ASM_POSIX_TYPES_H_FIXIDX, AAB_FD_ZERO_GNU_TYPES_H_FIXIDX, AAB_FD_ZERO_SELECTBITS_H_FIXIDX, AAB_SOLARIS_SYS_VARARGS_H_FIXIDX, AAB_SUN_MEMCPY_FIXIDX, + AAB_VXWORKS_ASSERT_FIXIDX, + AAB_VXWORKS_REGS_VXTYPES_FIXIDX, + AAB_VXWORKS_STDINT_FIXIDX, + AAB_VXWORKS_UNISTD_FIXIDX, AIX_COMPLEX_FIXIDX, AIX_MALLOC_FIXIDX, AIX_NET_IF_ARP_FIXIDX, @@ -8854,6 +9220,7 @@ typedef enum { CTRL_QUOTES_DEF_FIXIDX, CTRL_QUOTES_USE_FIXIDX, CXX_UNREADY_FIXIDX, + DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX, DARWIN_EXTERNC_FIXIDX, DARWIN_GCC4_BREAKAGE_FIXIDX, DARWIN_PRIVATE_EXTERN_FIXIDX, @@ -9017,9 +9384,13 @@ typedef enum { VMS_USE_FAST_SETJMP_FIXIDX, VOID_NULL_FIXIDX, VXWORKS_GCC_PROBLEM_FIXIDX, + VXWORKS_IOCTL_MACRO_FIXIDX, + VXWORKS_MKDIR_MACRO_FIXIDX, VXWORKS_NEEDS_VXTYPES_FIXIDX, VXWORKS_NEEDS_VXWORKS_FIXIDX, + VXWORKS_REGS_FIXIDX, VXWORKS_TIME_FIXIDX, + VXWORKS_WRITE_CONST_FIXIDX, X11_CLASS_FIXIDX, X11_CLASS_USAGE_FIXIDX, X11_NEW_FIXIDX, @@ -9042,11 +9413,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, aAab_Darwin7_9_Long_Double_FuncsTests, apzAab_Darwin7_9_Long_Double_FuncsPatch, 0 }, - { zAab_Darwin7_9_Long_Double_Funcs_2Name, zAab_Darwin7_9_Long_Double_Funcs_2List, - apzAab_Darwin7_9_Long_Double_Funcs_2Machs, - AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, - aAab_Darwin7_9_Long_Double_Funcs_2Tests, apzAab_Darwin7_9_Long_Double_Funcs_2Patch, 0 }, - { zAab_Fd_Zero_Asm_Posix_Types_HName, zAab_Fd_Zero_Asm_Posix_Types_HList, apzAab_Fd_Zero_Asm_Posix_Types_HMachs, AAB_FD_ZERO_ASM_POSIX_TYPES_H_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, @@ -9072,6 +9438,26 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AAB_SUN_MEMCPY_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, aAab_Sun_MemcpyTests, apzAab_Sun_MemcpyPatch, 0 }, + { zAab_Vxworks_AssertName, zAab_Vxworks_AssertList, + apzAab_Vxworks_AssertMachs, + AAB_VXWORKS_ASSERT_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, + aAab_Vxworks_AssertTests, apzAab_Vxworks_AssertPatch, 0 }, + + { zAab_Vxworks_Regs_VxtypesName, zAab_Vxworks_Regs_VxtypesList, + apzAab_Vxworks_Regs_VxtypesMachs, + AAB_VXWORKS_REGS_VXTYPES_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, + aAab_Vxworks_Regs_VxtypesTests, apzAab_Vxworks_Regs_VxtypesPatch, 0 }, + + { zAab_Vxworks_StdintName, zAab_Vxworks_StdintList, + apzAab_Vxworks_StdintMachs, + AAB_VXWORKS_STDINT_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, + aAab_Vxworks_StdintTests, apzAab_Vxworks_StdintPatch, 0 }, + + { zAab_Vxworks_UnistdName, zAab_Vxworks_UnistdList, + apzAab_Vxworks_UnistdMachs, + AAB_VXWORKS_UNISTD_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, + aAab_Vxworks_UnistdTests, apzAab_Vxworks_UnistdPatch, 0 }, + { zAix_ComplexName, zAix_ComplexList, apzAix_ComplexMachs, AIX_COMPLEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, @@ -9257,6 +9643,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aCxx_UnreadyTests, apzCxx_UnreadyPatch, 0 }, + { zDarwin_9_Long_Double_Funcs_2Name, zDarwin_9_Long_Double_Funcs_2List, + apzDarwin_9_Long_Double_Funcs_2Machs, + DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_9_Long_Double_Funcs_2Tests, apzDarwin_9_Long_Double_Funcs_2Patch, 0 }, + { zDarwin_ExterncName, zDarwin_ExterncList, apzDarwin_ExterncMachs, DARWIN_EXTERNC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, @@ -10072,6 +10463,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = { VXWORKS_GCC_PROBLEM_TEST_CT, FD_MACH_ONLY, aVxworks_Gcc_ProblemTests, apzVxworks_Gcc_ProblemPatch, 0 }, + { zVxworks_Ioctl_MacroName, zVxworks_Ioctl_MacroList, + apzVxworks_Ioctl_MacroMachs, + VXWORKS_IOCTL_MACRO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aVxworks_Ioctl_MacroTests, apzVxworks_Ioctl_MacroPatch, 0 }, + + { zVxworks_Mkdir_MacroName, zVxworks_Mkdir_MacroList, + apzVxworks_Mkdir_MacroMachs, + VXWORKS_MKDIR_MACRO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aVxworks_Mkdir_MacroTests, apzVxworks_Mkdir_MacroPatch, 0 }, + { zVxworks_Needs_VxtypesName, zVxworks_Needs_VxtypesList, apzVxworks_Needs_VxtypesMachs, VXWORKS_NEEDS_VXTYPES_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, @@ -10082,11 +10483,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = { VXWORKS_NEEDS_VXWORKS_TEST_CT, FD_MACH_ONLY, aVxworks_Needs_VxworksTests, apzVxworks_Needs_VxworksPatch, 0 }, + { zVxworks_RegsName, zVxworks_RegsList, + apzVxworks_RegsMachs, + VXWORKS_REGS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aVxworks_RegsTests, apzVxworks_RegsPatch, 0 }, + { zVxworks_TimeName, zVxworks_TimeList, apzVxworks_TimeMachs, VXWORKS_TIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aVxworks_TimeTests, apzVxworks_TimePatch, 0 }, + { zVxworks_Write_ConstName, zVxworks_Write_ConstList, + apzVxworks_Write_ConstMachs, + VXWORKS_WRITE_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aVxworks_Write_ConstTests, apzVxworks_Write_ConstPatch, 0 }, + { zX11_ClassName, zX11_ClassList, apzX11_ClassMachs, X11_CLASS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/fixlib.h b/fixincludes/fixlib.h index 42d98b22558..19df48a8b0f 100644 --- a/fixincludes/fixlib.h +++ b/fixincludes/fixlib.h @@ -140,7 +140,10 @@ typedef int apply_fix_p_t; /* Apply Fix Predicate Type */ "amount of user entertainment" ) \ \ _ENV_( pz_find_base, BOOL_TRUE, "FIND_BASE", \ - "leader to trim from file names" ) + "leader to trim from file names" ) \ + \ + _ENV_( pz_test_mode, BOOL_FALSE, "TEST_MODE", \ + "run fixincludes in test mode" ) #define _ENV_(v,m,n,t) extern tCC* v; ENV_TABLE @@ -211,6 +214,27 @@ typedef struct { extern int gnu_type_map_ct; +typedef enum { + VERB_SILENT = 0, + VERB_FIXES, + VERB_APPLIES, + VERB_PROGRESS, + VERB_TESTS, + VERB_EVERYTHING +} te_verbose; + +te_verbose verbose_level; + +#define VLEVEL(l) ((unsigned int) verbose_level >= (unsigned int) l) +#define NOT_SILENT VLEVEL(VERB_FIXES) + +typedef enum { + TESTING_OFF = 0, + TESTING_ON = 1 +} fixinc_mode_t; + +fixinc_mode_t fixinc_mode; + #ifdef HAVE_MMAP_FILE #define UNLOAD_DATA() do { if (curr_data_mapped) { \ munmap ((void*)pz_curr_data, data_map_size); close (data_map_fd); } \ diff --git a/fixincludes/fixopts.c b/fixincludes/fixopts.c index d305cd76747..4be36933c8f 100644 --- a/fixincludes/fixopts.c +++ b/fixincludes/fixopts.c @@ -20,31 +20,43 @@ along with GCC; see the file COPYING3. If not see #include "fixlib.h" -#define _ENV_(v,m,n,t) tCC* v = NULL; +te_verbose verbose_level = VERB_PROGRESS; + +fixinc_mode_t fixinc_mode = TESTING_OFF; + +#define _ENV_(v,m,n,t) char const * v = NULL; ENV_TABLE #undef _ENV_ -void -initialize_opts (void) +static void +show_not_def (char const * vname) { static const char var_not_found[] = -#ifndef __STDC__ - "fixincl ERROR: %s environment variable not defined\n" -#else "fixincl ERROR: %s environment variable not defined\n" - "each of these must be defined:\n" -# define _ENV_(vv,mm,nn,tt) "\t" nn " - " tt "\n" + "each of these must be defined:\n"; + static char const not_found_var[] = "\t%s\n"; + + fprintf (stderr, var_not_found, vname); +# define _ENV_(vv,mm,nn,tt) \ + if (mm) fprintf (stderr, not_found_var, nn); ENV_TABLE # undef _ENV_ -#endif - ; -#define _ENV_(v,m,n,t) { tSCC var[] = n; \ - v = getenv (var); if (m && (v == NULL)) { \ - fprintf (stderr, var_not_found, var); \ - exit (EXIT_FAILURE); } } + exit (EXIT_FAILURE); +} -ENV_TABLE +void +initialize_opts (void) +{ +#define _ENV_(v,m,n,t) { \ + static char const var[] = n; \ + v = getenv (var); \ + if (m && (v == NULL)) show_not_def (var); \ + } + ENV_TABLE; #undef _ENV_ + + if ((pz_test_mode != NULL) && (strcmp (pz_test_mode, "true") == 0)) + fixinc_mode = TESTING_ON; } diff --git a/fixincludes/fixtests.c b/fixincludes/fixtests.c index d668b92f2a1..f95dd73bc16 100644 --- a/fixincludes/fixtests.c +++ b/fixincludes/fixtests.c @@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "fixlib.h" -#define _ENV_(v,m,n,t) extern tCC* v; +#define _ENV_(v,m,n,t) extern char const * v; ENV_TABLE #undef _ENV_ diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index cc7d790b886..09eac7c6254 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -196,25 +196,6 @@ fix = { _EndOfHeader_; }; - -/* - * ... and for the previous fix to be useful, you have to not use "" - * includes. - */ -fix = { - hackname = AAB_darwin7_9_long_double_funcs_2; - mach = "*-*-darwin7.9*"; - files = math.h; - select = '#include[ \t]+\"'; - c_fix = format; - c_fix_arg = "%1<%2.h>"; - - c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; - - test_text = '#include "architecture/ppc/math.h"'; -}; - - /* * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n) */ @@ -1069,7 +1050,6 @@ fix = { test_text = "extern void exit ( int );"; }; - /* * Remove `extern double cabs' declarations from math.h. * This conflicts with C99. Discovered on AIX. @@ -1105,7 +1085,7 @@ fix = { */ files = "architecture/ppc/math.h"; files = "architecture/*/math.h"; - select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)"; + select = '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)'; bypass = "powl"; c_fix = format; c_fix_arg = "#if 1"; @@ -1179,6 +1159,9 @@ fix = { test_text = "#define _CTRL(c) ('c'&037)"; }; +/* + * Fix various macros used to define ioctl numbers. + */ fix = { hackname = ctrl_quotes_use; select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']"; @@ -1215,6 +1198,23 @@ fix = { test_text = "extern void* malloc( size_t );"; }; +/* + * For the AAB_darwin7_9_long_double_funcs fix to be useful, + * you have to not use "" includes. + */ +fix = { + hackname = darwin_9_long_double_funcs_2; + mach = "*-*-darwin7.9*"; + files = math.h; + select = '#include[ \t]+\"'; + c_fix = format; + c_fix_arg = "%1<%2.h>"; + + c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; + + test_text = '#include "architecture/ppc/math.h"'; +}; + /* * On darwin8 and earlier, mach-o/swap.h isn't properly guarded @@ -2498,6 +2498,9 @@ fix = { "#define XX_IO(x) ('x'<<8|256)"; }; +/* + * Fix the usage of the ioctl macro numbers. + */ fix = { hackname = io_quotes_use; select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*" diff --git a/fixincludes/tests/base/architecture/ppc/math.h b/fixincludes/tests/base/architecture/ppc/math.h index dcd04236bc9..4af7808fcc2 100644 --- a/fixincludes/tests/base/architecture/ppc/math.h +++ b/fixincludes/tests/base/architecture/ppc/math.h @@ -7,82 +7,8 @@ This had to be done to correct non-standard usages in the original, manufacturer supplied header file. */ -/* This file prototypes the long double functions available on Mac OS - 10.3.9. */ -#ifndef __MATH__ -# undef __APPLE_CC__ -# define __APPLE_CC__ 1345 -# include_next -# undef __APPLE_CC__ -# define __APPLE_CC__ 1 -# ifndef __LIBMLDBL_COMPAT -# ifdef __LONG_DOUBLE_128__ -# define __LIBMLDBL_COMPAT(sym) __asm("_" #sym "$LDBL128") -# else -# define __LIBMLDBL_COMPAT(sym) -# endif /* __LONG_DOUBLE_128__ */ -# endif /* __LIBMLDBL_COMPAT */ -# ifdef __cplusplus - extern "C" { -# endif - extern long double acosl( long double ) __LIBMLDBL_COMPAT(acosl); - extern long double asinl( long double ) __LIBMLDBL_COMPAT(asinl); - extern long double atanl( long double ) __LIBMLDBL_COMPAT(atanl); - extern long double atan2l( long double, long double ) __LIBMLDBL_COMPAT(atan2l); - extern long double cosl( long double ) __LIBMLDBL_COMPAT(cosl); - extern long double sinl( long double ) __LIBMLDBL_COMPAT(sinl); - extern long double tanl( long double ) __LIBMLDBL_COMPAT(tanl); - extern long double acoshl( long double ) __LIBMLDBL_COMPAT(acoshl); - extern long double asinhl( long double ) __LIBMLDBL_COMPAT(asinhl); - extern long double atanhl( long double ) __LIBMLDBL_COMPAT(atanhl); - extern long double coshl( long double ) __LIBMLDBL_COMPAT(coshl); - extern long double sinhl( long double ) __LIBMLDBL_COMPAT(sinhl); - extern long double tanhl( long double ) __LIBMLDBL_COMPAT(tanhl); - extern long double expl( long double ) __LIBMLDBL_COMPAT(expl); - extern long double exp2l( long double ) __LIBMLDBL_COMPAT(exp2l); - extern long double expm1l( long double ) __LIBMLDBL_COMPAT(expm1l); - extern long double logl( long double ) __LIBMLDBL_COMPAT(logl); - extern long double log10l( long double ) __LIBMLDBL_COMPAT(log10l); - extern long double log2l( long double ) __LIBMLDBL_COMPAT(log2l); - extern long double log1pl( long double ) __LIBMLDBL_COMPAT(log1pl); - extern long double logbl( long double ) __LIBMLDBL_COMPAT(logbl); - extern long double modfl( long double, long double * ) __LIBMLDBL_COMPAT(modfl); - extern long double ldexpl( long double, int ) __LIBMLDBL_COMPAT(ldexpl); - extern long double frexpl( long double, int * ) __LIBMLDBL_COMPAT(frexpl); - extern int ilogbl( long double ) __LIBMLDBL_COMPAT(ilogbl); - extern long double scalbnl( long double, int ) __LIBMLDBL_COMPAT(scalbnl); - extern long double scalblnl( long double, long int ) __LIBMLDBL_COMPAT(scalblnl); - extern long double fabsl( long double ) __LIBMLDBL_COMPAT(fabsl); - extern long double cbrtl( long double ) __LIBMLDBL_COMPAT(cbrtl); - extern long double hypotl( long double, long double ) __LIBMLDBL_COMPAT(hypotl); - extern long double powl( long double, long double ) __LIBMLDBL_COMPAT(powl); - extern long double sqrtl( long double ) __LIBMLDBL_COMPAT(sqrtl); - extern long double erfl( long double ) __LIBMLDBL_COMPAT(erfl); - extern long double erfcl( long double ) __LIBMLDBL_COMPAT(erfcl); - extern long double lgammal( long double ) __LIBMLDBL_COMPAT(lgammal); - extern long double tgammal( long double ) __LIBMLDBL_COMPAT(tgammal); - extern long double ceill( long double ) __LIBMLDBL_COMPAT(ceill); - extern long double floorl( long double ) __LIBMLDBL_COMPAT(floorl); - extern long double nearbyintl( long double ) __LIBMLDBL_COMPAT(nearbyintl); - extern long double rintl( long double ) __LIBMLDBL_COMPAT(rintl); - extern long int lrintl( long double ) __LIBMLDBL_COMPAT(lrintl); - extern long long int llrintl( long double ) __LIBMLDBL_COMPAT(llrintl); - extern long double roundl( long double ) __LIBMLDBL_COMPAT(roundl); - extern long int lroundl( long double ) __LIBMLDBL_COMPAT(lroundl); - extern long long int llroundl( long double ) __LIBMLDBL_COMPAT(llroundl); - extern long double truncl( long double ) __LIBMLDBL_COMPAT(truncl); - extern long double fmodl( long double, long double) __LIBMLDBL_COMPAT(fmodl); - extern long double remainderl( long double, long double ) __LIBMLDBL_COMPAT(remainderl); - extern long double remquol( long double, long double, int * ) __LIBMLDBL_COMPAT(remquol); - extern long double copysignl( long double, long double ) __LIBMLDBL_COMPAT(copysignl); - extern long double nanl( const char * ) __LIBMLDBL_COMPAT(nanl); - extern long double nextafterl( long double, long double ) __LIBMLDBL_COMPAT(nextafterl); - extern long double nexttowardl( long double, long double ) __LIBMLDBL_COMPAT(nexttowardl); - extern long double fdiml( long double, long double ) __LIBMLDBL_COMPAT(fdiml); - extern long double fmaxl( long double, long double ) __LIBMLDBL_COMPAT(fmaxl); - extern long double fminl( long double, long double ) __LIBMLDBL_COMPAT(fminl); - extern long double fmal( long double, long double, long double ) __LIBMLDBL_COMPAT(fmal); -# ifdef __cplusplus - } -# endif -#endif /* __MATH__ */ + + +#if defined( BROKEN_NAN_CHECK ) +#if 1 +#endif /* BROKEN_NAN_CHECK */ diff --git a/fixincludes/tests/base/ioLib.h b/fixincludes/tests/base/ioLib.h new file mode 100644 index 00000000000..d570c895d57 --- /dev/null +++ b/fixincludes/tests/base/ioLib.h @@ -0,0 +1,19 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/ioLib.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( VXWORKS_IOCTL_MACRO_CHECK ) +extern int ioctl ( int asdf1234, int jkl , int qwerty ) ; +#endif /* VXWORKS_IOCTL_MACRO_CHECK */ + + +#if defined( VXWORKS_WRITE_CONST_CHECK ) +extern int write (int, const char*, size_t); +#endif /* VXWORKS_WRITE_CONST_CHECK */ -- cgit v1.2.3