From patchwork Mon Aug 8 12:30:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Glisse X-Patchwork-Id: 108903 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 F1E23B6F70 for ; Mon, 8 Aug 2011 22:31:11 +1000 (EST) Received: (qmail 6381 invoked by alias); 8 Aug 2011 12:31:10 -0000 Received: (qmail 6371 invoked by uid 22791); 8 Aug 2011 12:31:09 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, TW_CX X-Spam-Check-By: sourceware.org Received: from mail1-relais-roc.national.inria.fr (HELO mail1-relais-roc.national.inria.fr) (192.134.164.82) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Aug 2011 12:30:40 +0000 Received: from stedding.saclay.inria.fr ([193.55.250.194]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 08 Aug 2011 14:30:39 +0200 Received: from glisse (helo=localhost) by stedding.saclay.inria.fr with local-esmtp (Exim 4.76) (envelope-from ) id 1QqOyc-0000hj-Su for gcc-patches@gcc.gnu.org; Mon, 08 Aug 2011 14:30:38 +0200 Date: Mon, 8 Aug 2011 14:30:38 +0200 (CEST) From: Marc Glisse To: gcc-patches@gcc.gnu.org Subject: [PATCH] non-GNU C++ compilers Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-ID: 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 Hello, this helps C++ compilers that do not define __GNUC__ compile gcc. Bootstrapped: 1) CC=gcc with --disable-build-poststage1-with-cxx 2) CC=suncc The second one required a fix for PR49907. I didn't build with sunCC simply because it requires several more patches. Issues were discussed there: http://gcc.gnu.org/ml/gcc/2011-07/msg00523.html http://gcc.gnu.org/ml/gcc/2011-08/msg00006.html Note that I can't commit. 2011-08-08 Marc Glisse * include/ansidecl.h (ENUM_BITFIELD): Always use enum in C++ * include/obstack.h (obstack_free): Cast to char* instead of int Index: include/ansidecl.h =================================================================== --- include/ansidecl.h (revision 177557) +++ include/ansidecl.h (working copy) @@ -416,10 +416,12 @@ #define EXPORTED_CONST const #endif -/* Be conservative and only use enum bitfields with GCC. +/* Be conservative and only use enum bitfields with C++ or GCC. FIXME: provide a complete autoconf test for buggy enum bitfields. */ -#if (GCC_VERSION > 2000) +#ifdef __cplusplus +#define ENUM_BITFIELD(TYPE) enum TYPE +#elif (GCC_VERSION > 2000) #define ENUM_BITFIELD(TYPE) __extension__ enum TYPE #else #define ENUM_BITFIELD(TYPE) unsigned int Index: include/obstack.h =================================================================== --- include/obstack.h (revision 177557) +++ include/obstack.h (working copy) @@ -532,9 +532,9 @@ # define obstack_free(h,obj) \ ( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ - ? (int) ((h)->next_free = (h)->object_base \ + ? ((h)->next_free = (h)->object_base \ = (h)->temp + (char *) (h)->chunk) \ - : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) + : ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), (char*)0))) #endif /* not __GNUC__ or not __STDC__ */