From: Rainer Orth Date: Wed, 10 Aug 2011 08:43:38 +0000 (+0000) Subject: re PR libstdc++/1773 (__cplusplus defined to 1, should be 199711L) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d62bab6a7c366d625c1f31903ec971f4e5f1349e;p=gcc.git re PR libstdc++/1773 (__cplusplus defined to 1, should be 199711L) 2011-08-10 Rainer Orth Marc Glisse PR libstdc++-v3/1773 * inclhack.def (solaris_cxx_linkage, solaris_getc_strict_stdc) (solaris_longjmp_noreturn, solaris_pow_int_overload) (solaris_std___filbuf): New fixes. * tests/base/iso/math_iso.h, tests/base/iso/setjmp_iso.h, tests/base/iso/stdio_iso.h, tests/base/iso/stdlib_iso.h: New tests. * tests/base/stdio.h [SOLARIS_STD___FILBUF_CHECK]: New test. Co-Authored-By: Marc Glisse From-SVN: r177613 --- diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index b063cfd1f96..deb7cec35fc 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,14 @@ +2011-08-10 Rainer Orth + Marc Glisse + + PR libstdc++-v3/1773 + * inclhack.def (solaris_cxx_linkage, solaris_getc_strict_stdc) + (solaris_longjmp_noreturn, solaris_pow_int_overload) + (solaris_std___filbuf): New fixes. + * tests/base/iso/math_iso.h, tests/base/iso/setjmp_iso.h, + tests/base/iso/stdio_iso.h, tests/base/iso/stdlib_iso.h: New tests. + * tests/base/stdio.h [SOLARIS_STD___FILBUF_CHECK]: New test. + 2011-07-25 Rainer Orth PR c++/49347 diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 9363ae9bdbe..843b5e3ad2b 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 July 23, 2011 at 01:16:35 AM MEST + * It has been AutoGen-ed Tuesday August 9, 2011 at 09:17:43 PM MEST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jul 23 01:16:35 MEST 2011 +/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Aug 9 21:17:43 MEST 2011 * * 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 212 fixup descriptions. + * This file contains 217 fixup descriptions. * * See README for more information. * @@ -6341,6 +6341,127 @@ static const char* apzSolaris_Cond_InitPatch[] = { "^(#define[ \t]+PTHREAD_COND_INITIALIZER[ \t]+\\{.*0)(\\},[ \t]*0\\}.*)$", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Cxx_Linkage fix + */ +tSCC zSolaris_Cxx_LinkageName[] = + "solaris_cxx_linkage"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Cxx_LinkageList[] = + "iso/stdlib_iso.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzSolaris_Cxx_LinkageMachs[] = { + "*-*-solaris2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Cxx_LinkageSelect0[] = + "(#if __cplusplus >= 199711L)\n\ +(extern \"C\\+\\+\" \\{\n\ +)(.*(bsearch|qsort).*)"; + +#define SOLARIS_CXX_LINKAGE_TEST_CT 1 +static tTestDesc aSolaris_Cxx_LinkageTests[] = { + { TT_EGREP, zSolaris_Cxx_LinkageSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Cxx_Linkage + */ +static const char* apzSolaris_Cxx_LinkagePatch[] = { + "format", + "%1 && !__GNUG__\n\ +%2%3", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Getc_Strict_Stdc fix + */ +tSCC zSolaris_Getc_Strict_StdcName[] = + "solaris_getc_strict_stdc"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Getc_Strict_StdcList[] = + "iso/stdio_iso.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzSolaris_Getc_Strict_StdcMachs[] = { + "*-*-solaris2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Getc_Strict_StdcSelect0[] = + "(.*&& )!defined\\(_STRICT_STDC\\)(.*)"; + +#define SOLARIS_GETC_STRICT_STDC_TEST_CT 1 +static tTestDesc aSolaris_Getc_Strict_StdcTests[] = { + { TT_EGREP, zSolaris_Getc_Strict_StdcSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Getc_Strict_Stdc + */ +static const char* apzSolaris_Getc_Strict_StdcPatch[] = { + "format", + "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Longjmp_Noreturn fix + */ +tSCC zSolaris_Longjmp_NoreturnName[] = + "solaris_longjmp_noreturn"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Longjmp_NoreturnList[] = + "iso/setjmp_iso.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzSolaris_Longjmp_NoreturnMachs[] = { + "*-*-solaris2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Longjmp_NoreturnSelect0[] = + "(.*longjmp\\(jmp_buf.*[^)]+\\));"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Longjmp_NoreturnBypass0[] = + "__NORETURN"; + +#define SOLARIS_LONGJMP_NORETURN_TEST_CT 2 +static tTestDesc aSolaris_Longjmp_NoreturnTests[] = { + { TT_NEGREP, zSolaris_Longjmp_NoreturnBypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Longjmp_NoreturnSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Longjmp_Noreturn + */ +static const char* apzSolaris_Longjmp_NoreturnPatch[] = { + "format", + "%1 __attribute__ ((__noreturn__));", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Solaris_Math_1 fix @@ -6687,6 +6808,46 @@ static const char* apzSolaris_Mutex_Init_2Patch[] = { [ \t]*)\\{.*),[ \t]*0\\}(|[ \t].*)$", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Pow_Int_Overload fix + */ +tSCC zSolaris_Pow_Int_OverloadName[] = + "solaris_pow_int_overload"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Pow_Int_OverloadList[] = + "iso/math_iso.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzSolaris_Pow_Int_OverloadMachs[] = { + "*-*-solaris2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Pow_Int_OverloadSelect0[] = + "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\) *\\{[^{}]*\n\ +[^{}]*\\}"; + +#define SOLARIS_POW_INT_OVERLOAD_TEST_CT 1 +static tTestDesc aSolaris_Pow_Int_OverloadTests[] = { + { TT_EGREP, zSolaris_Pow_Int_OverloadSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Pow_Int_Overload + */ +static const char* apzSolaris_Pow_Int_OverloadPatch[] = { + "format", + "#ifndef __GXX_EXPERIMENTAL_CXX0X__\n\ +%0\n\ +#endif", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Solaris_Rwlock_Init_1 fix @@ -7043,6 +7204,55 @@ static const char* apzSolaris_Posix_Spawn_RestrictPatch[] = { "%1*_RESTRICT_KYWD %2%3", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Solaris_Std___Filbuf fix + */ +tSCC zSolaris_Std___FilbufName[] = + "solaris_std___filbuf"; + +/* + * File name selection pattern + */ +tSCC zSolaris_Std___FilbufList[] = + "stdio.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzSolaris_Std___FilbufMachs[] = { + "*-*-solaris2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zSolaris_Std___FilbufSelect0[] = + "(using std::perror;\n\ +)(#endif)"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zSolaris_Std___FilbufBypass0[] = + "using std::__filbuf"; + +#define SOLARIS_STD___FILBUF_TEST_CT 2 +static tTestDesc aSolaris_Std___FilbufTests[] = { + { TT_NEGREP, zSolaris_Std___FilbufBypass0, (regex_t*)NULL }, + { TT_EGREP, zSolaris_Std___FilbufSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Solaris_Std___Filbuf + */ +static const char* apzSolaris_Std___FilbufPatch[] = { + "format", + "%1#ifndef _LP64\n\ +using std::__filbuf;\n\ +using std::__flsbuf;\n\ +#endif\n\ +%2", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Solaris_Stdio_Tag fix @@ -8628,9 +8838,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 251 +#define REGEX_COUNT 258 #define MACH_LIST_SIZE_LIMIT 181 -#define FIX_COUNT 212 +#define FIX_COUNT 217 /* * Enumerate the fixes @@ -8792,6 +9002,9 @@ typedef enum { SOLARIS_COMPLEX_FIXIDX, SOLARIS_COMPLEX_CXX_FIXIDX, SOLARIS_COND_INIT_FIXIDX, + SOLARIS_CXX_LINKAGE_FIXIDX, + SOLARIS_GETC_STRICT_STDC_FIXIDX, + SOLARIS_LONGJMP_NORETURN_FIXIDX, SOLARIS_MATH_1_FIXIDX, SOLARIS_MATH_2_FIXIDX, SOLARIS_MATH_3_FIXIDX, @@ -8800,6 +9013,7 @@ typedef enum { SOLARIS_MATH_9_FIXIDX, SOLARIS_MATH_10_FIXIDX, SOLARIS_MUTEX_INIT_2_FIXIDX, + SOLARIS_POW_INT_OVERLOAD_FIXIDX, SOLARIS_RWLOCK_INIT_1_FIXIDX, SOLARIS_ONCE_INIT_1_FIXIDX, SOLARIS_ONCE_INIT_2_FIXIDX, @@ -8809,6 +9023,7 @@ typedef enum { SOLARIS_INT_LIMITS_3_FIXIDX, SOLARIS_INT_TYPES_FIXIDX, SOLARIS_POSIX_SPAWN_RESTRICT_FIXIDX, + SOLARIS_STD___FILBUF_FIXIDX, SOLARIS_STDIO_TAG_FIXIDX, SOLARIS_SYS_VA_LIST_FIXIDX, STATSSWTCH_FIXIDX, @@ -9631,6 +9846,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = { SOLARIS_COND_INIT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aSolaris_Cond_InitTests, apzSolaris_Cond_InitPatch, 0 }, + { zSolaris_Cxx_LinkageName, zSolaris_Cxx_LinkageList, + apzSolaris_Cxx_LinkageMachs, + SOLARIS_CXX_LINKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Cxx_LinkageTests, apzSolaris_Cxx_LinkagePatch, 0 }, + + { zSolaris_Getc_Strict_StdcName, zSolaris_Getc_Strict_StdcList, + apzSolaris_Getc_Strict_StdcMachs, + SOLARIS_GETC_STRICT_STDC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Getc_Strict_StdcTests, apzSolaris_Getc_Strict_StdcPatch, 0 }, + + { zSolaris_Longjmp_NoreturnName, zSolaris_Longjmp_NoreturnList, + apzSolaris_Longjmp_NoreturnMachs, + SOLARIS_LONGJMP_NORETURN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Longjmp_NoreturnTests, apzSolaris_Longjmp_NoreturnPatch, 0 }, + { zSolaris_Math_1Name, zSolaris_Math_1List, apzSolaris_Math_1Machs, SOLARIS_MATH_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, @@ -9671,6 +9901,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { SOLARIS_MUTEX_INIT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aSolaris_Mutex_Init_2Tests, apzSolaris_Mutex_Init_2Patch, 0 }, + { zSolaris_Pow_Int_OverloadName, zSolaris_Pow_Int_OverloadList, + apzSolaris_Pow_Int_OverloadMachs, + SOLARIS_POW_INT_OVERLOAD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Pow_Int_OverloadTests, apzSolaris_Pow_Int_OverloadPatch, 0 }, + { zSolaris_Rwlock_Init_1Name, zSolaris_Rwlock_Init_1List, apzSolaris_Rwlock_Init_1Machs, SOLARIS_RWLOCK_INIT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, @@ -9716,6 +9951,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { SOLARIS_POSIX_SPAWN_RESTRICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aSolaris_Posix_Spawn_RestrictTests, apzSolaris_Posix_Spawn_RestrictPatch, 0 }, + { zSolaris_Std___FilbufName, zSolaris_Std___FilbufList, + apzSolaris_Std___FilbufMachs, + SOLARIS_STD___FILBUF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aSolaris_Std___FilbufTests, apzSolaris_Std___FilbufPatch, 0 }, + { zSolaris_Stdio_TagName, zSolaris_Stdio_TagList, apzSolaris_Stdio_TagMachs, SOLARIS_STDIO_TAG_TEST_CT, FD_MACH_ONLY, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index df6d1a955ff..d538706156a 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -3357,6 +3357,59 @@ fix = { }; +/* + * g++ rejects functions declared with both C and C++ linkage. + */ +fix = { + hackname = solaris_cxx_linkage; + mach = '*-*-solaris2*'; + files = "iso/stdlib_iso.h"; + select = "(#if __cplusplus >= 199711L)\n" + "(extern \"C\\+\\+\" \\{\n)" + "(.*(bsearch|qsort).*)"; + c_fix = format; + c_fix_arg = "%1 && !__GNUG__\n%2%3"; + + test_text = + "#if __cplusplus >= 199711L\n" + "extern \"C++\" {\n" + " void *bsearch(const void *, const void *, size_t, size_t,"; +}; + + +/* + * Solaris doesn't declare getc for C++ with + * _STRICT_STDC, but uses it. + */ +fix = { + hackname = solaris_getc_strict_stdc; + mach = "*-*-solaris2*"; + files = "iso/stdio_iso.h"; + select = "(.*&& )!defined\\(_STRICT_STDC\\)(.*)"; + c_fix = format; + c_fix_arg = "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2"; + + test_text = + "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)"; +}; + + +/* + * Before Solaris 10, doesn't mark longjump noreturn. + */ +fix = { + hackname = solaris_longjmp_noreturn; + mach = "*-*-solaris2*"; + files = "iso/setjmp_iso.h"; + bypass = "__NORETURN"; + select = "(.*longjmp\\(jmp_buf.*[^)]+\\));"; + c_fix = format; + c_fix_arg = "%1 __attribute__ ((__noreturn__));"; + + test_text = "extern void longjmp(jmp_buf, int);"; +}; + + /* * Sun Solaris 10 defines several C99 math macros in terms of * builtins specific to the Studio compiler, in particular not @@ -3529,6 +3582,24 @@ fix = { }; +/* + * The pow overloads with int were removed in C++ 2011. + */ +fix = { + hackname = solaris_pow_int_overload; + mach = '*-*-solaris2*'; + files = "iso/math_iso.h"; + select = "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)" + " *\\{[^{}]*\n[^{}]*\\}"; + c_fix = format; + c_fix_arg = "#ifndef __GXX_EXPERIMENTAL_CXX0X__\n%0\n#endif"; + + test_text = + " inline long double pow(long double __X, int __Y) { return\n" + " __powl(__X, (long double) (__Y)); }"; +}; + + /* * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some * fields of the pthread_rwlock_t structure, which are of type @@ -3722,6 +3793,27 @@ fix = { }; +/* + * Before Solaris 10, lacks declarations of std::__filbuf and + * std::__flsbuf, but uses them. + */ +fix = { + hackname = solaris_std___filbuf; + files = stdio.h; + mach = '*-*-solaris2*'; + bypass = "using std::__filbuf"; + select = "(using std::perror;\n)(#endif)"; + c_fix = format; + c_fix_arg = "%1#ifndef _LP64\n" + "using std::__filbuf;\n" + "using std::__flsbuf;\n" + "#endif\n%2"; + + test_text = "using std::perror;\n" + "#endif"; +}; + + /* * Sun Solaris 8 has what appears to be some gross workaround for * some old version of their c++ compiler. G++ doesn't want it diff --git a/fixincludes/tests/base/iso/math_iso.h b/fixincludes/tests/base/iso/math_iso.h new file mode 100644 index 00000000000..6c08a94bb54 --- /dev/null +++ b/fixincludes/tests/base/iso/math_iso.h @@ -0,0 +1,17 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/iso/math_iso.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( SOLARIS_POW_INT_OVERLOAD_CHECK ) +#ifndef __GXX_EXPERIMENTAL_CXX0X__ + inline long double pow(long double __X, int __Y) { return + __powl(__X, (long double) (__Y)); } +#endif +#endif /* SOLARIS_POW_INT_OVERLOAD_CHECK */ diff --git a/fixincludes/tests/base/iso/setjmp_iso.h b/fixincludes/tests/base/iso/setjmp_iso.h new file mode 100644 index 00000000000..4cf872007cf --- /dev/null +++ b/fixincludes/tests/base/iso/setjmp_iso.h @@ -0,0 +1,14 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/iso/setjmp_iso.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( SOLARIS_LONGJMP_NORETURN_CHECK ) +extern void longjmp(jmp_buf, int) __attribute__ ((__noreturn__)); +#endif /* SOLARIS_LONGJMP_NORETURN_CHECK */ diff --git a/fixincludes/tests/base/iso/stdio_iso.h b/fixincludes/tests/base/iso/stdio_iso.h new file mode 100644 index 00000000000..d476752f092 --- /dev/null +++ b/fixincludes/tests/base/iso/stdio_iso.h @@ -0,0 +1,14 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/iso/stdio_iso.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( SOLARIS_GETC_STRICT_STDC_CHECK ) +#if !defined(_REENTRANT) && !defined(_LP64) && (!defined(_STRICT_STDC) || (__cplusplus >= 199711L)) +#endif /* SOLARIS_GETC_STRICT_STDC_CHECK */ diff --git a/fixincludes/tests/base/iso/stdlib_iso.h b/fixincludes/tests/base/iso/stdlib_iso.h new file mode 100644 index 00000000000..3fb5b349559 --- /dev/null +++ b/fixincludes/tests/base/iso/stdlib_iso.h @@ -0,0 +1,16 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/iso/stdlib_iso.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( SOLARIS_CXX_LINKAGE_CHECK ) +#if __cplusplus >= 199711L && !__GNUG__ +extern "C++" { + void *bsearch(const void *, const void *, size_t, size_t, +#endif /* SOLARIS_CXX_LINKAGE_CHECK */ diff --git a/fixincludes/tests/base/stdio.h b/fixincludes/tests/base/stdio.h index 5fda7bd34d1..975d0a52168 100644 --- a/fixincludes/tests/base/stdio.h +++ b/fixincludes/tests/base/stdio.h @@ -65,6 +65,16 @@ extern int rename(const char *_old, const char *_new); #endif /* RS6000_PARAM_CHECK */ +#if defined( SOLARIS_STD___FILBUF_CHECK ) +using std::perror; +#ifndef _LP64 +using std::__filbuf; +using std::__flsbuf; +#endif +#endif +#endif /* SOLARIS_STD___FILBUF_CHECK */ + + #if defined( STDIO_STDARG_H_CHECK ) #endif /* STDIO_STDARG_H_CHECK */