From patchwork Thu Aug 13 17:33:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edelsohn X-Patchwork-Id: 507131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 13A2C1401CD for ; Fri, 14 Aug 2015 03:33:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=AZIvHzUl; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=arZkLLYKFUJsqqYEmZAXrhQGZBHjfeWKmTaxnzdSxyA yJmKduOD1Csj09ibsS2Qir/Ph5uZM/BMF8ss5z1d/GIu8mh3ZusvhteJPU4saAaA 6Brkc2TzfvUrAH5etHeCHn2dT4LkGUHe330eBPN+hn4NZdSx/ctH5hqPxMvpdN+w = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=6GtLwdrKQH5AS5ndujvb2s/KJwY=; b=AZIvHzUlA3etxfBP8 RCoAjYONJwOKfL7Iz1HVEAnB9NTfv6Avh09WuSq24WMG2+GOnLP0N2YuRfbGyEp4 zo8BTDG/zUIbV1702wib1q5K9CLLGnOpFZ63kjHOcEBiLl9ZSCw/vaQiuUclUf5U 6ubtEYr0794zREWWRl7d07kTAc= Received: (qmail 80514 invoked by alias); 13 Aug 2015 17:33:07 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 80497 invoked by uid 89); 13 Aug 2015 17:33:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f175.google.com Received: from mail-io0-f175.google.com (HELO mail-io0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 13 Aug 2015 17:33:02 +0000 Received: by iodt126 with SMTP id t126so59737060iod.2 for ; Thu, 13 Aug 2015 10:33:00 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.137.31 with SMTP id l31mr11524278iod.37.1439487180631; Thu, 13 Aug 2015 10:33:00 -0700 (PDT) Received: by 10.36.133.5 with HTTP; Thu, 13 Aug 2015 10:33:00 -0700 (PDT) Date: Thu, 13 Aug 2015 13:33:00 -0400 Message-ID: Subject: [PATCH, FIXINCLUDES] AIX stdio C++ inline fix From: David Edelsohn To: Bruce Korb Cc: GCC Patches 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"; +}; + + +/*