# HG changeset patch
# Parent 8b946d3b0b1ff1d40660db201feee5925260f9ee
Only declare gets for C++ < 2014 on Solaris (PR libstdc++/78979)
@@ -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 = {
@@ -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 */
new file mode 100644
@@ -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 */
@@ -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 */