This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, FIXINCLUDES] AIX stdio C++ inline fix
- From: Bruce Korb <bkorb at gnu dot org>
- To: David Edelsohn <dje dot gcc at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 13 Aug 2015 12:02:09 -0700
- Subject: Re: [PATCH, FIXINCLUDES] AIX stdio C++ inline fix
- Authentication-results: sourceware.org; auth=none
- References: <CAGWvnymy4bxqBh2h-rvhL4XBfwQQRq3ryODr+VX1tGV+Qpj-Fg at mail dot gmail dot com>
Looks good to me...
On Thu, Aug 13, 2015 at 10:33 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
> 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";
> +};
> +
> +
> +/*