From b6bbae95ae907674aeffdea7a4afb87afb97504d Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Tue, 9 Oct 2007 23:22:02 +0000 Subject: [PATCH] inclhack.def (darwin_externc): New. * inclhack.def (darwin_externc): New. * fixincl.x: Regenerate. * tests/base/mach-o/swap.h: New. From-SVN: r129188 --- fixincludes/ChangeLog | 6 +++ fixincludes/fixincl.x | 61 +++++++++++++++++++++++++--- fixincludes/inclhack.def | 26 ++++++++++++ fixincludes/tests/base/mach-o/swap.h | 26 ++++++++++++ 4 files changed, 114 insertions(+), 5 deletions(-) create mode 100644 fixincludes/tests/base/mach-o/swap.h diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 44a2c117674..79b8fccbc74 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,9 @@ +2007-10-09 Geoffrey Keating + + * inclhack.def (darwin_externc): New. + * fixincl.x: Regenerate. + * tests/base/mach-o/swap.h: New. + 2007-08-03 Kaveh R. Ghazi * inclhack.def (solaris_math_5, solaris_math_6, solaris_math_7): diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 93f2ae08725..599bb21d8a3 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 Friday August 3, 2007 at 09:50:46 PM EDT + * It has been AutoGen-ed Monday October 8, 2007 at 12:36:37 PM PDT * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Aug 3 21:50:46 EDT 2007 +/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Oct 8 12:36:37 PDT 2007 * * 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 208 fixup descriptions. + * This file contains 209 fixup descriptions. * * See README for more information. * @@ -1877,6 +1877,51 @@ extern \"C\" {\n\ #endif\n", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Externc fix + */ +tSCC zDarwin_ExterncName[] = + "darwin_externc"; + +/* + * File name selection pattern + */ +tSCC zDarwin_ExterncList[] = + "mach-o/swap.h\0mach/mach_time.h\0mach/mach_traps.h\0mach/message.h\0mach/mig.h\0mach/semaphore.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_ExterncMachs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zDarwin_ExterncBypass0[] = + "extern \"C\""; +tSCC zDarwin_ExterncBypass1[] = + "__BEGIN_DECLS"; + +#define DARWIN_EXTERNC_TEST_CT 2 +static tTestDesc aDarwin_ExterncTests[] = { + { TT_NEGREP, zDarwin_ExterncBypass0, (regex_t*)NULL }, + { TT_NEGREP, zDarwin_ExterncBypass1, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Externc + */ +static const char* apzDarwin_ExterncPatch[] = { + "wrap", + "#ifdef __cplusplus\n\ +extern \"C\" {\n\ +#endif\n", + "#ifdef __cplusplus\n\ +}\n\ +#endif\n", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Darwin_Gcc4_Breakage fix @@ -8456,9 +8501,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 250 +#define REGEX_COUNT 252 #define MACH_LIST_SIZE_LIMIT 261 -#define FIX_COUNT 208 +#define FIX_COUNT 209 /* * Enumerate the fixes @@ -8506,6 +8551,7 @@ typedef enum { CTRL_QUOTES_DEF_FIXIDX, CTRL_QUOTES_USE_FIXIDX, CXX_UNREADY_FIXIDX, + DARWIN_EXTERNC_FIXIDX, DARWIN_GCC4_BREAKAGE_FIXIDX, DARWIN_PRIVATE_EXTERN_FIXIDX, DEC_INTERN_ASM_FIXIDX, @@ -8885,6 +8931,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aCxx_UnreadyTests, apzCxx_UnreadyPatch, 0 }, + { zDarwin_ExterncName, zDarwin_ExterncList, + apzDarwin_ExterncMachs, + DARWIN_EXTERNC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_ExterncTests, apzDarwin_ExterncPatch, 0 }, + { zDarwin_Gcc4_BreakageName, zDarwin_Gcc4_BreakageList, apzDarwin_Gcc4_BreakageMachs, DARWIN_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index fde081652fe..08989c9e750 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1166,6 +1166,32 @@ fix = { }; +/* + * On darwin8 and earlier, mach-o/swap.h isn't properly guarded + * by 'extern "C"'. On darwin7 some mach/ headers aren't properly guarded. + */ +fix = { + hackname = darwin_externc; + mach = "*-*-darwin*"; + files = mach-o/swap.h; + files = mach/mach_time.h; + files = mach/mach_traps.h; + files = mach/message.h; + files = mach/mig.h; + files = mach/semaphore.h; + bypass = "extern \"C\""; + bypass = "__BEGIN_DECLS"; + c_fix = wrap; + c_fix_arg = "#ifdef __cplusplus\n" + "extern \"C\" {\n" + "#endif\n"; + c_fix_arg = "#ifdef __cplusplus\n" + "}\n" + "#endif\n"; + test_text = "extern void swap_fat_header();\n"; +}; + + /* * AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of * bad __GNUC__ tests. diff --git a/fixincludes/tests/base/mach-o/swap.h b/fixincludes/tests/base/mach-o/swap.h new file mode 100644 index 00000000000..1bc65d4c86a --- /dev/null +++ b/fixincludes/tests/base/mach-o/swap.h @@ -0,0 +1,26 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/mach-o/swap.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + +#ifndef FIXINC_WRAP_MACH_O_SWAP_H_DARWIN_EXTERNC +#define FIXINC_WRAP_MACH_O_SWAP_H_DARWIN_EXTERNC 1 + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined( DARWIN_EXTERNC_CHECK ) +extern void swap_fat_header(); + +#endif /* DARWIN_EXTERNC_CHECK */ +#ifdef __cplusplus +} +#endif + +#endif /* FIXINC_WRAP_MACH_O_SWAP_H_DARWIN_EXTERNC */