OSDN Git Service

2011-08-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
[pf3gnuchains/gcc-fork.git] / fixincludes / inclhack.def
index df6d1a9..d538706 100644 (file)
@@ -3358,6 +3358,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 <iso/stdio_iso.h> 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, <iso/setjmp_iso.h> 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
  * compatible with the GNU compiler.
@@ -3530,6 +3583,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
  *  upad64_t, which itself is typedef'd to int64_t, but with __STDC__
@@ -3723,6 +3794,27 @@ fix = {
 
 
 /*
+ * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
+ * std::__flsbuf, but <iso/stdio_iso.h> 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
  * either, but doesn't want to be tied to SunPRO version numbers.