From patchwork Mon Nov 5 06:09:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 197149 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]) by ozlabs.org (Postfix) with SMTP id A4A5C2C0093 for ; Mon, 5 Nov 2012 17:10:10 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352700610; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:CC:Subject:In-Reply-To:References:User-Agent: Date:Message-ID:MIME-Version:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=v1rkQaQV/2y6jswZEdQ+haLehQM=; b=SonT6F+sQqtyNjYHIEBOiliRnzCcm7W2vUlaJsskr7uu643WH5Xn3DuVuqDi2b nhvP5dzGh70Zth6E4chHg+Jc+vtQnFh005UW35tFS2KN6sd5sqL/lMBgXPVpSGVM O2IH92jWxsJxNrSnFyaIukZ8FoLEEoVJDDWjQNqHc1vUg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:CC:Subject:In-Reply-To:References:User-Agent:Date:Message-ID:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=VsJXs7OZ7H2MWXphM6GG5prUWS9xt7bhjJP3As1eGjEs18bebgcyh+TSIalFVA i7hncoiC8wfxhBdT9cY9yRNUaTIpJilTWVP8bveyDUYd3lNZJxZmE8TD6DhCY9hQ B6RiWe1Plll0DnVWlIFm7pVuMrsiBlZ36O0sVOUamV32c=; Received: (qmail 31858 invoked by alias); 5 Nov 2012 06:10:03 -0000 Received: (qmail 31762 invoked by uid 22791); 5 Nov 2012 06:10:00 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL, BAYES_00, KHOP_PGP_SIGNED, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Nov 2012 06:09:55 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TVFsd-0001Ed-US from Thomas_Schwinge@mentor.com ; Sun, 04 Nov 2012 22:09:51 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 4 Nov 2012 22:09:51 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Mon, 5 Nov 2012 06:09:50 +0000 From: Thomas Schwinge To: Samuel Thibault , CC: Svante Signell , , Roland McGrath , debian-hurd Subject: GCC for GNU Hurd: MACH built-in preprocessor macro (was: gdb: FTBFS on hurd-i386 (for review)) In-Reply-To: <20120928075641.GB5370@type.eduroam.uu.se> References: <1348668149.30025.18.camel@s1499.it.kth.se> <87haqkszqs.fsf@kepler.schwinge.homeip.net> <20120928075641.GB5370@type.eduroam.uu.se> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) Date: Mon, 5 Nov 2012 07:09:43 +0100 Message-ID: <874nl4a8d4.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 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 Hi! On Fri, 28 Sep 2012 09:56:41 +0200, Samuel Thibault wrote: > Thomas Schwinge, le Thu 27 Sep 2012 09:15:23 +0200, a écrit : > > On Wed, 26 Sep 2012 16:02:29 +0200, Svante Signell wrote: > > > gdb does not build from source any longer since gdb-multiarch packages > > > was enabled in 7.4.1-1. The build problems are due to two reasons: > > > > I also once had a look and came to the same conclusion. > > > > > First the reserved keyword MACH is defined in include/objcode/h8300.h > > > causing problems since gcc defines it for GNU/Hurd. > > > > Correct. And I wonder if that isn't a name-space violation? This is > > what I meant to look up when working on this two months ago, but then it > > seems I again got distracted by other issues. Roland, do you have any > > comments regarding that? > > > > [GCC]/gcc/config/gnu.h: > > [...] > > #undef GNU_USER_TARGET_OS_CPP_BUILTINS > > #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ > > do { \ > > builtin_define ("__gnu_hurd__"); \ > > builtin_define ("__GNU__"); \ > > builtin_define_std ("unix"); \ > > builtin_define_std ("MACH"); \ > > builtin_assert ("system=gnu"); \ > > builtin_assert ("system=mach"); \ > > builtin_assert ("system=unix"); \ > > builtin_assert ("system=posix"); \ > > } while (0) > > > > $ gcc -dM -E -x c - < /dev/null | grep -i mach > > #define __MACH 1 > > #define __MACH__ 1 > > #define MACH 1 > > On Linux i386, both "linux" and "i386" macros are defined, which poses > its own problems too. (Let's pause for a moment in remembrance of the »glibc vs. i686 defined« issue that would nearly have seen its 10th anniversary these days.) > I'd indeed tend to say that defining a non-underscored macro is only a > way for troubles. > > > Could we/should we remove the latter one? Though, I have no idea how > > much user code is relying on MACH being #defined. I had a colleague > > check, and Apple/Darwin systems do *only* #define __MACH__ (as well as > > __APPLE__). Here is the straightforward patch. With it, only the __MACH__ built-in preprocessor macro remains, and we get: [...] Fixing headers into /home/thomas/tmp/gnu-0/obj/gcc/gcc/include-fixed for i686-pc-gnu target -Forbidden identifiers: MACH i386 unix +Forbidden identifiers: i386 unix [...] These two are to remain. Samuel, is there any way you can unpack all Debian source packages on a Debian machine, and run a recursive grep command (I can work out a suitable regex) to see where removing the MACH or __MACH built-in preprocessor macros might cause trouble? Grüße, Thomas diff --git gcc/config/gnu.h gcc/config/gnu.h index dddbcbf..4d9449e 100644 --- gcc/config/gnu.h +++ gcc/config/gnu.h @@ -34,7 +34,7 @@ along with GCC. If not, see . builtin_define ("__gnu_hurd__"); \ builtin_define ("__GNU__"); \ builtin_define_std ("unix"); \ - builtin_define_std ("MACH"); \ + builtin_define ("__MACH__"); \ builtin_assert ("system=gnu"); \ builtin_assert ("system=mach"); \ builtin_assert ("system=unix"); \