From patchwork Tue Apr 30 14:40:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Edelsohn X-Patchwork-Id: 240632 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 008562C00CC for ; Wed, 1 May 2013 00:40:11 +1000 (EST) 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:content-type; q= dns; s=default; b=F/EKAJEX94Xf+2go9sMKx3ywgs03sd73i8ehrKZ0YP83qP JfL7Kpf3BjxF4UkG+lR6si/BbOy5FsTVeGef/K9eE1aANBd37GmY8xNJ7IB7/Ngs nqTWnfpc2ecEftv6AHCTZvUrfYeRB8tVmvhpgy3x+nG28Bqh6I42QZw7GNdIw= 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:content-type; s= default; bh=dhFWMdIGdIvhhen+Hxzsfl2k2js=; b=Bxnz09Sc861fZlsMPxhw lSkPTXO+Olm5sJi6T4zgCakV6phGzuBed9CINsqabezP0dvF/eHtJ7qzimvB0RXQ T+kptOA9o5U+qpnQ0lKT169aiQUwJyh/yvOli80WjESYfZDN7STKd18yXpuESRcD AZO2HZjoosBFlJ94NhYE0KY= Received: (qmail 3198 invoked by alias); 30 Apr 2013 14:40:04 -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 3187 invoked by uid 89); 30 Apr 2013 14:40:04 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-vb0-f51.google.com (HELO mail-vb0-f51.google.com) (209.85.212.51) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 30 Apr 2013 14:40:03 +0000 Received: by mail-vb0-f51.google.com with SMTP id x16so451249vbf.24 for ; Tue, 30 Apr 2013 07:40:01 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.52.32.194 with SMTP id l2mr29587807vdi.14.1367332801748; Tue, 30 Apr 2013 07:40:01 -0700 (PDT) Received: by 10.220.66.200 with HTTP; Tue, 30 Apr 2013 07:40:01 -0700 (PDT) Date: Tue, 30 Apr 2013 10:40:01 -0400 Message-ID: Subject: [PATCH, fixincludes] Fix NULL on AIX From: David Edelsohn To: GCC Patches , Mike Stump , Bruce Korb AIX headers do not have a complete definition of NULL and the GCC build complains about "missing sentinel". The appended patch substitutes a more complete definition of NULL that satisfies GCC/G++. I also updated the void_null fix, which was discussed in 2011 to substitute a more complete definition of NULL. void_null no longer triggers on AIX because of the "__cplusplus" bypass, which appears in AIX header files. I can omit void_null from the patch or remove the fix completely if it no longer is applicable to any target. (Yes, I will update fixinclude tests, but I first want agreement on the fix itself.) Bootstrapped on powerpc-ibm-aix7.1.0.0. Thanks, David * inclhack.def (aix_null): New. (void_null): Substitute newer definition of NULL. * fixincl.x: Regenerate. Index: inclhack.def =================================================================== --- inclhack.def (revision 198437) +++ inclhack.def (working copy) @@ -617,6 +617,31 @@ }; /* + * Fix AIX definition of NULL for G++. + */ +fix = { + hackname = aix_null; + mach = "*-*-aix*"; + files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h, + time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h; + bypass = __null; + select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*"; + c_fix = format; + c_fix_arg = "#ifndef NULL\n" + "#ifdef __cplusplus\n" + "#ifdef __GNUG__\n" + "#define NULL\t__null\n" + "#else\t /* ! __GNUG__ */\n" + "#define NULL\t0L\n" + "#endif\t /* __GNUG__ */\n" + "#else\t /* ! __cplusplus */\n" + "#define NULL\t((void *)0)\n" + "#endif\t /* __cplusplus */\n" + "#endif\t /* !NULL */"; + test_text = "# define\tNULL \t(0L) /* typed NULL */"; +}; + +/* * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER, * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough * braces. @@ -4552,23 +4577,24 @@ */ fix = { hackname = void_null; - files = curses.h; - files = dbm.h; - files = locale.h; - files = stdio.h; - files = stdlib.h; - files = string.h; - files = time.h; - files = unistd.h; - files = sys/dir.h; - files = sys/param.h; - files = sys/types.h; + files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h, + time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h; /* avoid changing C++ friendly NULL */ bypass = __cplusplus; bypass = __null; select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)"; c_fix = format; - c_fix_arg = "#define NULL 0"; + c_fix_arg = "#ifndef NULL\n" + "#ifdef __cplusplus\n" + "#ifdef __GNUG__\n" + "#define NULL\t__null\n" + "#else\t /* ! __GNUG__ */\n" + "#define NULL\t0L\n" + "#endif\t /* __GNUG__ */\n" + "#else\t /* ! __cplusplus */\n" + "#define NULL\t((void *)0)\n" + "#endif\t /* __cplusplus */\n" + "#endif\t /* !NULL */"; test_text = "# define\tNULL \t((void *)0) /* typed NULL */"; };