aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2017-01-13 12:09:13 +0000
committerRainer Orth <ro@gcc.gnu.org>2017-01-13 12:09:13 +0000
commit2252a8025df20cb5c58659cde04ac0ee0eee3ee1 (patch)
tree7409cd5362bbab1784a96fbdfb5284ad35c4d7b6
parenta181b2bcd7d3d8e7af0f4503b5425ea0b5738c82 (diff)
downloadgcc-2252a8025df20cb5c58659cde04ac0ee0eee3ee1.zip
gcc-2252a8025df20cb5c58659cde04ac0ee0eee3ee1.tar.gz
gcc-2252a8025df20cb5c58659cde04ac0ee0eee3ee1.tar.bz2
Only declare gets for C++ < 2014 on Solaris (PR libstdc++/78979)
PR libstdc++/78979 * inclhack.def (solaris_gets_c11, solaris_gets_cxx14) (solaris_std_gets_cxx14, solaris_stdlib_noreturn): New fixes. * fixincl.x: Regenerate. * tests/base/iso/stdio_iso.h [SOLARIS_GETS_C11_CHECK, SOLARIS_GETS_CXX14_CHECK, SOLARIS_STD_GETS_CXX14_CHECK, SOLARIS_STDLIB_NORETURN_CHECK]: New tests. From-SVN: r244428
-rw-r--r--fixincludes/ChangeLog10
-rw-r--r--fixincludes/fixincl.x188
-rw-r--r--fixincludes/inclhack.def67
-rw-r--r--fixincludes/tests/base/iso/stdio_iso.h13
-rw-r--r--fixincludes/tests/base/iso/stdlib_c99.h14
-rw-r--r--fixincludes/tests/base/stdio.h7
6 files changed, 294 insertions, 5 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index d447171..2e6dd11 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,13 @@
+2017-01-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR libstdc++/78979
+ * inclhack.def (solaris_gets_c11, solaris_gets_cxx14)
+ (solaris_std_gets_cxx14, solaris_stdlib_noreturn): New fixes.
+ * fixincl.x: Regenerate.
+ * tests/base/iso/stdio_iso.h [SOLARIS_GETS_C11_CHECK,
+ SOLARIS_GETS_CXX14_CHECK, SOLARIS_STD_GETS_CXX14_CHECK,
+ SOLARIS_STDLIB_NORETURN_CHECK]: New tests.
+
2016-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* inclhack.def (solaris_math_12): New fix.
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index b0eeef9..6a010d6 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 November 20, 2016 at 12:02:46 PM by AutoGen 5.16.2
+ * It has been AutoGen-ed January 12, 2017 at 11:46:34 AM by AutoGen 5.16.2
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Nov 20 12:02:47 MET 2016
+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jan 12 11:46:34 2017
*
* 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 242 fixup descriptions.
+ * This file contains 246 fixup descriptions.
*
* See README for more information.
*
@@ -7068,6 +7068,84 @@ static const char* apzSolaris_Getc_Strict_StdcPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris_Gets_C11 fix
+ */
+tSCC zSolaris_Gets_C11Name[] =
+ "solaris_gets_c11";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Gets_C11List[] =
+ "iso/stdio_iso.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Gets_C11Machs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Gets_C11Select0[] =
+ "(extern char[ \t]*\\*gets\\(char \\*\\));";
+
+#define SOLARIS_GETS_C11_TEST_CT 1
+static tTestDesc aSolaris_Gets_C11Tests[] = {
+ { TT_EGREP, zSolaris_Gets_C11Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Gets_C11
+ */
+static const char* apzSolaris_Gets_C11Patch[] = {
+ "format",
+ "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n\
+%1 __attribute__((__deprecated__));\n\
+#endif",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Solaris_Gets_Cxx14 fix
+ */
+tSCC zSolaris_Gets_Cxx14Name[] =
+ "solaris_gets_cxx14";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Gets_Cxx14List[] =
+ "iso/stdio_iso.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Gets_Cxx14Machs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Gets_Cxx14Select0[] =
+ "(#if __STDC_VERSION__ < 201112L)\n\
+(extern char\t\\*gets\\(char \\*\\) __ATTR_DEPRECATED;)";
+
+#define SOLARIS_GETS_CXX14_TEST_CT 1
+static tTestDesc aSolaris_Gets_Cxx14Tests[] = {
+ { TT_EGREP, zSolaris_Gets_Cxx14Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Gets_Cxx14
+ */
+static const char* apzSolaris_Gets_Cxx14Patch[] = {
+ "format",
+ "%1 && __cplusplus < 201402L\n\
+%2",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Solaris_Int_Const fix
*/
tSCC zSolaris_Int_ConstName[] =
@@ -7820,6 +7898,45 @@ using std::__flsbuf;\n\
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris_Std_Gets_Cxx14 fix
+ */
+tSCC zSolaris_Std_Gets_Cxx14Name[] =
+ "solaris_std_gets_cxx14";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Std_Gets_Cxx14List[] =
+ "stdio.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Std_Gets_Cxx14Machs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Std_Gets_Cxx14Select0[] =
+ "using std::gets;";
+
+#define SOLARIS_STD_GETS_CXX14_TEST_CT 1
+static tTestDesc aSolaris_Std_Gets_Cxx14Tests[] = {
+ { TT_EGREP, zSolaris_Std_Gets_Cxx14Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Std_Gets_Cxx14
+ */
+static const char* apzSolaris_Std_Gets_Cxx14Patch[] = {
+ "format",
+ "#if __cplusplus < 201402L\n\
+%0\n\
+#endif",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Solaris_Stdio_Tag fix
*/
tSCC zSolaris_Stdio_TagName[] =
@@ -7861,6 +7978,43 @@ static const char* apzSolaris_Stdio_TagPatch[] = { sed_cmd_z,
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Solaris_Stdlib_Noreturn fix
+ */
+tSCC zSolaris_Stdlib_NoreturnName[] =
+ "solaris_stdlib_noreturn";
+
+/*
+ * File name selection pattern
+ */
+tSCC zSolaris_Stdlib_NoreturnList[] =
+ "iso/stdlib_c99.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzSolaris_Stdlib_NoreturnMachs[] = {
+ "*-*-solaris2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zSolaris_Stdlib_NoreturnSelect0[] =
+ "(extern) _Noreturn (void quick_exit\\(int\\));";
+
+#define SOLARIS_STDLIB_NORETURN_TEST_CT 1
+static tTestDesc aSolaris_Stdlib_NoreturnTests[] = {
+ { TT_EGREP, zSolaris_Stdlib_NoreturnSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Solaris_Stdlib_Noreturn
+ */
+static const char* apzSolaris_Stdlib_NoreturnPatch[] = {
+ "format",
+ "%1 %2 __attribute__((__noreturn__));",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Statsswtch fix
*/
tSCC zStatsswtchName[] =
@@ -9908,9 +10062,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 279
+#define REGEX_COUNT 283
#define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT 242
+#define FIX_COUNT 246
/*
* Enumerate the fixes
@@ -10087,6 +10241,8 @@ typedef enum {
SOLARIS_COMPLEX_CXX_FIXIDX,
SOLARIS_CXX_LINKAGE_FIXIDX,
SOLARIS_GETC_STRICT_STDC_FIXIDX,
+ SOLARIS_GETS_C11_FIXIDX,
+ SOLARIS_GETS_CXX14_FIXIDX,
SOLARIS_INT_CONST_FIXIDX,
SOLARIS_INT_LIMITS_1_FIXIDX,
SOLARIS_INT_LIMITS_2_FIXIDX,
@@ -10105,7 +10261,9 @@ typedef enum {
SOLARIS_POW_INT_OVERLOAD_FIXIDX,
SOLARIS_RWLOCK_INIT_1_FIXIDX,
SOLARIS_STD___FILBUF_FIXIDX,
+ SOLARIS_STD_GETS_CXX14_FIXIDX,
SOLARIS_STDIO_TAG_FIXIDX,
+ SOLARIS_STDLIB_NORETURN_FIXIDX,
STATSSWTCH_FIXIDX,
STDIO_STDARG_H_FIXIDX,
STDIO_VA_LIST_FIXIDX,
@@ -11016,6 +11174,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
SOLARIS_GETC_STRICT_STDC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aSolaris_Getc_Strict_StdcTests, apzSolaris_Getc_Strict_StdcPatch, 0 },
+ { zSolaris_Gets_C11Name, zSolaris_Gets_C11List,
+ apzSolaris_Gets_C11Machs,
+ SOLARIS_GETS_C11_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Gets_C11Tests, apzSolaris_Gets_C11Patch, 0 },
+
+ { zSolaris_Gets_Cxx14Name, zSolaris_Gets_Cxx14List,
+ apzSolaris_Gets_Cxx14Machs,
+ SOLARIS_GETS_CXX14_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Gets_Cxx14Tests, apzSolaris_Gets_Cxx14Patch, 0 },
+
{ zSolaris_Int_ConstName, zSolaris_Int_ConstList,
apzSolaris_Int_ConstMachs,
SOLARIS_INT_CONST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@@ -11106,11 +11274,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
SOLARIS_STD___FILBUF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aSolaris_Std___FilbufTests, apzSolaris_Std___FilbufPatch, 0 },
+ { zSolaris_Std_Gets_Cxx14Name, zSolaris_Std_Gets_Cxx14List,
+ apzSolaris_Std_Gets_Cxx14Machs,
+ SOLARIS_STD_GETS_CXX14_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Std_Gets_Cxx14Tests, apzSolaris_Std_Gets_Cxx14Patch, 0 },
+
{ zSolaris_Stdio_TagName, zSolaris_Stdio_TagList,
apzSolaris_Stdio_TagMachs,
SOLARIS_STDIO_TAG_TEST_CT, FD_MACH_ONLY,
aSolaris_Stdio_TagTests, apzSolaris_Stdio_TagPatch, 0 },
+ { zSolaris_Stdlib_NoreturnName, zSolaris_Stdlib_NoreturnList,
+ apzSolaris_Stdlib_NoreturnMachs,
+ SOLARIS_STDLIB_NORETURN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aSolaris_Stdlib_NoreturnTests, apzSolaris_Stdlib_NoreturnPatch, 0 },
+
{ zStatsswtchName, zStatsswtchList,
apzStatsswtchMachs,
STATSSWTCH_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 240fc74..03a267b 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -3593,6 +3593,43 @@ fix = {
};
/*
+ * Solaris <iso/stdio_iso.h> should deprecate gets before C11.
+ */
+fix = {
+ hackname = solaris_gets_c11;
+ mach = "*-*-solaris2*";
+ files = "iso/stdio_iso.h";
+ select = "(extern char[ \t]*\\*gets\\(char \\*\\));";
+
+ c_fix = format;
+ c_fix_arg = "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n"
+ "%1 __attribute__((__deprecated__));\n"
+ "#endif";
+
+ test_text = "extern char *gets(char *);";
+};
+
+/*
+ * Solaris <iso/stdio_iso.h> shouldn't declare gets for C++14.
+ */
+fix = {
+ hackname = solaris_gets_cxx14;
+ mach = "*-*-solaris2*";
+ files = "iso/stdio_iso.h";
+ select = <<- _EOSelect_
+(#if __STDC_VERSION__ < 201112L)
+(extern char \*gets\(char \*\) __ATTR_DEPRECATED;)
+_EOSelect_;
+ c_fix = format;
+ c_fix_arg = "%1 && __cplusplus < 201402L\n%2";
+
+ test_text = <<- _EOText_
+#if __STDC_VERSION__ < 201112L
+extern char *gets(char *) __ATTR_DEPRECATED;
+_EOText_;
+};
+
+/*
* Sun Solaris 2 has a version of sys/int_const.h that defines
* UINT8_C and UINT16_C to unsigned constants.
*/
@@ -3982,6 +4019,21 @@ fix = {
};
/*
+ * Solaris <stdio.h> shouldn't use std::gets for C++14.
+ */
+fix = {
+ hackname = solaris_std_gets_cxx14;
+ mach = "*-*-solaris2*";
+ files = "stdio.h";
+ select = "using std::gets;";
+
+ c_fix = format;
+ c_fix_arg = "#if __cplusplus < 201402L\n%0\n#endif";
+
+ test_text = "using std::gets;";
+};
+
+/*
* Sun Solaris 8 has what appears to be some gross workaround for
* some old version of their c++ compiler. G++ doesn't want it
* either, but doesn't want to be tied to SunPRO version numbers.
@@ -4000,6 +4052,21 @@ fix = {
};
/*
+ * Solaris <stdlib.h> shouldn't use _Noreturn, breaks with C++.
+ */
+fix = {
+ hackname = solaris_stdlib_noreturn;
+ mach = "*-*-solaris2*";
+ files = "iso/stdlib_c99.h";
+ select = "(extern) _Noreturn (void quick_exit\\(int\\));";
+
+ c_fix = format;
+ c_fix_arg = "%1 %2 __attribute__((__noreturn__));";
+
+ test_text = "extern _Noreturn void quick_exit(int);";
+};
+
+/*
* a missing semi-colon at the end of the statsswtch structure definition.
*/
fix = {
diff --git a/fixincludes/tests/base/iso/stdio_iso.h b/fixincludes/tests/base/iso/stdio_iso.h
index d476752..e2d70b4 100644
--- a/fixincludes/tests/base/iso/stdio_iso.h
+++ b/fixincludes/tests/base/iso/stdio_iso.h
@@ -12,3 +12,16 @@
#if defined( SOLARIS_GETC_STRICT_STDC_CHECK )
#if !defined(_REENTRANT) && !defined(_LP64) && (!defined(_STRICT_STDC) || (__cplusplus >= 199711L))
#endif /* SOLARIS_GETC_STRICT_STDC_CHECK */
+
+
+#if defined( SOLARIS_GETS_C11_CHECK )
+#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L
+extern char *gets(char *) __attribute__((__deprecated__));
+#endif
+#endif /* SOLARIS_GETS_C11_CHECK */
+
+
+#if defined( SOLARIS_GETS_CXX14_CHECK )
+#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L
+extern char *gets(char *) __ATTR_DEPRECATED;
+#endif /* SOLARIS_GETS_CXX14_CHECK */
diff --git a/fixincludes/tests/base/iso/stdlib_c99.h b/fixincludes/tests/base/iso/stdlib_c99.h
new file mode 100644
index 0000000..0c500de
--- /dev/null
+++ b/fixincludes/tests/base/iso/stdlib_c99.h
@@ -0,0 +1,14 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/iso/stdlib_c99.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( SOLARIS_STDLIB_NORETURN_CHECK )
+extern void quick_exit(int) __attribute__((__noreturn__));
+#endif /* SOLARIS_STDLIB_NORETURN_CHECK */
diff --git a/fixincludes/tests/base/stdio.h b/fixincludes/tests/base/stdio.h
index 4ca4faf..491c75d 100644
--- a/fixincludes/tests/base/stdio.h
+++ b/fixincludes/tests/base/stdio.h
@@ -90,6 +90,13 @@ using std::__flsbuf;
#endif /* SOLARIS_STD___FILBUF_CHECK */
+#if defined( SOLARIS_STD_GETS_CXX14_CHECK )
+#if __cplusplus < 201402L
+using std::gets;
+#endif
+#endif /* SOLARIS_STD_GETS_CXX14_CHECK */
+
+
#if defined( STDIO_STDARG_H_CHECK )
#endif /* STDIO_STDARG_H_CHECK */