This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, FIXINCLUDES] AIX stdio C++ inline fix


AIX stdio.h header includes code specific for C++ that looks like:

extern "C" {
#ifdef __cplusplus
#ifdef ferror
#undef ferror
inline int ferror(FILE * _p)
{
        return ((_p)->_flag & _IOERR);
}
#endif /*ferror*/

which generates code that makes the AIX linker and loader rather upset
because the inline function is not mangled and conflicts with the C
library.

This fixincludes patch protects this code with an addition test for
IBMCPP (not that IBMCPP will use GCC include-fixed headers, but ....).

Okay?

Thanks, David

* inclhack.def (aix_stdio_inline): New fix.
* fixincl.x: Regenerated.
* test/base/stdio.h [AIX_STDIO_INLINE]: New test.

Index: inclhack.def
===================================================================
--- inclhack.def    (revision 226860)
+++ inclhack.def    (working copy)
@@ -892,10 +892,32 @@
 };

 /*
+ * stdio.h on AIX defines ferror, clearerr and feof as C++ inline, which
+   produces wrong code with G++.
+ */
+fix = {
+    hackname  = aix_stdio_inline;
+    mach      = "*-*-aix*";
+    files     = stdio.h;
+    select    = "#ifdef __cplusplus\\\n"
+                "}\\\n\\\n"
+                "#ifdef ferror\\\n";
+    c_fix     = format;
+    c_fix_arg = "#ifdef __cplusplus\n"
+                "}\n"
+                "#endif\n\n"
+                "#if (defined(__cplusplus) && defined(__IBMCPP__))\n"
+                "#ifdef ferror\n";
+    test_text = "#ifdef __cplusplus\n}\n\n#ifdef ferror";
+};
+
+
+/*


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]