This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, FIXINCLUDES] AIX stdio C++ inline fix
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: Bruce Korb <bkorb at gnu dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 13 Aug 2015 13:33:00 -0400
- Subject: [PATCH, FIXINCLUDES] AIX stdio C++ inline fix
- Authentication-results: sourceware.org; auth=none
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";
+};
+
+
+/*