From: David Edelsohn Date: Thu, 21 May 2015 17:25:00 +0000 (+0000) Subject: inclhack.def (aix_externc): New fix. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9846edffa4b32333e313d5760e16efdb3dae5291;p=gcc.git inclhack.def (aix_externc): New fix. * inclhack.def (aix_externc): New fix. (aix_externcpp[12]): New fix. * fixincl.x: Regenerate. * test/base/ctype.h [AIX_EXTERNC_CHECK]: New test. * test/base/sys/socket.h [AIX_EXTERNCPP[12]_CHECK]: New test. * test/base/fcntl.h: New file. From-SVN: r223497 --- diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 8bab3f87424..4ac5138ebdc 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,12 @@ +2015-05-21 David Edelsohn + + * inclhack.def (aix_externc): New fix. + (aix_externcpp[12]): New fix. + * fixincl.x: Regenerate. + * test/base/ctype.h [AIX_EXTERNC_CHECK]: New test. + * test/base/sys/socket.h [AIX_EXTERNCPP[12]_CHECK]: New test. + * test/base/fcntl.h: New file. + 2015-05-13 Michael Haubenwallner * aclocal.m4: Regenerated with automake-1.11.6. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 68bb9a8347b..d796014275e 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 March 28, 2015 at 01:24:12 PM EDT + * It has been AutoGen-ed May 21, 2015 at 02:48:12 AM by AutoGen 5.18.3 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat 28 Mar 2015 13:24:12 EDT +/* DO NOT SVN-MERGE THIS FILE, EITHER Thu May 21 02:48:12 UTC 2015 * * 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 226 fixup descriptions. + * This file contains 229 fixup descriptions. * * See README for more information. * @@ -810,6 +810,124 @@ static const char* apzAix_ComplexPatch[] = { "#define _Complex_I (__extension__ 1.0iF)", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Externc fix + */ +tSCC zAix_ExterncName[] = + "aix_externc"; + +/* + * File name selection pattern + */ +tSCC zAix_ExterncList[] = + "ctype.h\0fcntl.h\0langinfo.h\0ldfcn.h\0sys/localedef.h\0sys/times.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_ExterncMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zAix_ExterncBypass0[] = + "extern \"C\""; + +#define AIX_EXTERNC_TEST_CT 1 +static tTestDesc aAix_ExterncTests[] = { + { TT_NEGREP, zAix_ExterncBypass0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Externc + */ +static const char* apzAix_ExterncPatch[] = { + "wrap", + "#ifdef __cplusplus\n\ +extern \"C\" {\n\ +#endif\n", + "#ifdef __cplusplus\n\ +}\n\ +#endif\n", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Externcpp1 fix + */ +tSCC zAix_Externcpp1Name[] = + "aix_externcpp1"; + +/* + * File name selection pattern + */ +tSCC zAix_Externcpp1List[] = + "sys/socket.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Externcpp1Machs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Externcpp1Select0[] = + "#ifdef __cplusplus"; + +#define AIX_EXTERNCPP1_TEST_CT 1 +static tTestDesc aAix_Externcpp1Tests[] = { + { TT_EGREP, zAix_Externcpp1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Externcpp1 + */ +static const char* apzAix_Externcpp1Patch[] = { + "format", + "#ifdef __cplusplus\n\ +extern \"C++\" {", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Externcpp2 fix + */ +tSCC zAix_Externcpp2Name[] = + "aix_externcpp2"; + +/* + * File name selection pattern + */ +tSCC zAix_Externcpp2List[] = + "sys/socket.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Externcpp2Machs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Externcpp2Select0[] = + "#else /\\* __cplusplus \\*/"; + +#define AIX_EXTERNCPP2_TEST_CT 1 +static tTestDesc aAix_Externcpp2Tests[] = { + { TT_EGREP, zAix_Externcpp2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Externcpp2 + */ +static const char* apzAix_Externcpp2Patch[] = { + "format", + "} /* extern \"C++\" */\n\ +#else /* __cplusplus */", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Malloc fix @@ -9278,9 +9396,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 263 +#define REGEX_COUNT 266 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 226 +#define FIX_COUNT 229 /* * Enumerate the fixes @@ -9300,6 +9418,9 @@ typedef enum { AAB_VXWORKS_UNISTD_FIXIDX, AIX_ASSERT_FIXIDX, AIX_COMPLEX_FIXIDX, + AIX_EXTERNC_FIXIDX, + AIX_EXTERNCPP1_FIXIDX, + AIX_EXTERNCPP2_FIXIDX, AIX_MALLOC_FIXIDX, AIX_NET_IF_ARP_FIXIDX, AIX_NULL_FIXIDX, @@ -9585,6 +9706,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AIX_COMPLEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aAix_ComplexTests, apzAix_ComplexPatch, 0 }, + { zAix_ExterncName, zAix_ExterncList, + apzAix_ExterncMachs, + AIX_EXTERNC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_ExterncTests, apzAix_ExterncPatch, 0 }, + + { zAix_Externcpp1Name, zAix_Externcpp1List, + apzAix_Externcpp1Machs, + AIX_EXTERNCPP1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Externcpp1Tests, apzAix_Externcpp1Patch, 0 }, + + { zAix_Externcpp2Name, zAix_Externcpp2List, + apzAix_Externcpp2Machs, + AIX_EXTERNCPP2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Externcpp2Tests, apzAix_Externcpp2Patch, 0 }, + { zAix_MallocName, zAix_MallocList, apzAix_MallocMachs, AIX_MALLOC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 314e283c533..89c7aa8d938 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -596,6 +596,56 @@ fix = { test_text = "#define _Complex_I __I\n"; }; +/* + * On AIX some headers are not properly guarded by 'extern "C"'. + */ +fix = { + hackname = aix_externc; + mach = "*-*-aix*"; + files = ctype.h; + files = fcntl.h; + files = langinfo.h; + files = ldfcn.h; + files = sys/localedef.h; + files = sys/times.h; + bypass = "extern \"C\""; + 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 int __n_pthreads;\n"; +}; + +/* + * On AIX sys/socket.h assumes C++. + */ +fix = { + hackname = aix_externcpp1; + mach = "*-*-aix*"; + files = "sys/socket.h"; + select = "#ifdef __cplusplus"; + c_fix = format; + c_fix_arg = "#ifdef __cplusplus\n" + "extern \"C++\" {"; + test_text = "#ifdef __cplusplus"; + +}; + +fix = { + hackname = aix_externcpp2; + mach = "*-*-aix*"; + files = "sys/socket.h"; + select = "#else /\\* __cplusplus \\*/"; + c_fix = format; + c_fix_arg = "} /* extern \"C++\" */\n" + "#else /* __cplusplus */"; + test_text = "#else /* __cplusplus */"; + +}; + /* * malloc.h on AIX6 uses XLC++ specific builtin syntax */ diff --git a/fixincludes/tests/base/ctype.h b/fixincludes/tests/base/ctype.h index deabd5e4473..834b2e52c33 100644 --- a/fixincludes/tests/base/ctype.h +++ b/fixincludes/tests/base/ctype.h @@ -7,6 +7,18 @@ This had to be done to correct non-standard usages in the original, manufacturer supplied header file. */ +#ifndef FIXINC_WRAP_CTYPE_H_AIX_EXTERNC +#define FIXINC_WRAP_CTYPE_H_AIX_EXTERNC 1 + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined( AIX_EXTERNC_CHECK ) +extern int __n_pthreads; + +#endif /* AIX_EXTERNC_CHECK */ #if defined( HPUX10_CTYPE_DECLARATIONS1_CHECK ) @@ -63,3 +75,8 @@ extern int __toupper(); # define isalpha(__c) (__SB_masks ? (int)__SB_masks[__c] & _IS #endif /* HPUX_CTYPE_MACROS_CHECK */ +#ifdef __cplusplus +} +#endif + +#endif /* FIXINC_WRAP_CTYPE_H_AIX_EXTERNC */ diff --git a/fixincludes/tests/base/fcntl.h b/fixincludes/tests/base/fcntl.h new file mode 100644 index 00000000000..3a40c01cabe --- /dev/null +++ b/fixincludes/tests/base/fcntl.h @@ -0,0 +1,25 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/fcntl.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + +#ifndef FIXINC_WRAP_FCNTL_H_AIX_EXTERNC +#define FIXINC_WRAP_FCNTL_H_AIX_EXTERNC 1 + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined( AAB_AIX_FCNTL_CHECK ) + +#endif /* AAB_AIX_FCNTL_CHECK */ +#ifdef __cplusplus +} +#endif + +#endif /* FIXINC_WRAP_FCNTL_H_AIX_EXTERNC */ diff --git a/fixincludes/tests/base/sys/socket.h b/fixincludes/tests/base/sys/socket.h index d0cd37e2574..5d66f8be291 100644 --- a/fixincludes/tests/base/sys/socket.h +++ b/fixincludes/tests/base/sys/socket.h @@ -9,6 +9,18 @@ +#if defined( AIX_EXTERNCPP1_CHECK ) +#ifdef __cplusplus +extern "C++" { +#endif /* AIX_EXTERNCPP1_CHECK */ + + +#if defined( AIX_EXTERNCPP2_CHECK ) +} /* extern "C++" */ +#else /* __cplusplus */ +#endif /* AIX_EXTERNCPP2_CHECK */ + + #if defined( HPUX11_EXTERN_SENDFILE_CHECK ) #ifndef _APP32_64BIT_OFF_T extern sbsize_t sendfile __((int, int, off_t, bsize_t,