From patchwork Tue Sep 21 18:29:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 65364 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 3ECEDB70CD for ; Wed, 22 Sep 2010 04:30:08 +1000 (EST) Received: (qmail 31047 invoked by alias); 21 Sep 2010 18:30:04 -0000 Received: (qmail 30995 invoked by uid 22791); 21 Sep 2010 18:30:02 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-qy0-f182.google.com (HELO mail-qy0-f182.google.com) (209.85.216.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Sep 2010 18:29:56 +0000 Received: by qyk4 with SMTP id 4so6696270qyk.20 for ; Tue, 21 Sep 2010 11:29:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.79.75 with SMTP id o11mr7637278qck.96.1285093794415; Tue, 21 Sep 2010 11:29:54 -0700 (PDT) Received: by 10.229.182.15 with HTTP; Tue, 21 Sep 2010 11:29:54 -0700 (PDT) Date: Tue, 21 Sep 2010 20:29:54 +0200 Message-ID: Subject: [RFC PATCH]: Define "bool" as _Bool when bootstrapping with gcc >= 4.4 From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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! Attached patch defines bool as _Bool when bootstrapping (or compiling with gcc >= 4.4). 2010-09-21 Uros Bizjak * system.h (bool): Define as _Bool for gcc >= 4.4. (BOOL_BITFILED): Ditto. Attached patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32} and alphaev68-pc-linux-gnu without problems. The version of bootstrap compiler is set to 4.4 since this is the version of the bootstrap compiler I have, and I'm pretty confident it won't make problems on the targets I have tested. RFC patch for now, but I think it is ready for inclusion into mainline SVN. Uros. Index: system.h =================================================================== --- system.h (revision 164480) +++ system.h (working copy) @@ -621,29 +621,29 @@ This must be after all inclusion of system headers, as some of them will mess us up. */ -#undef TRUE -#undef FALSE +#ifndef __cplusplus +# undef bool -#ifdef __cplusplus - /* Obsolete. */ -# define TRUE true -# define FALSE false -#else /* !__cplusplus */ -# undef bool +# if GCC_VERSION >= 4004 +# define bool _Bool +# define BOOL_BITFIELD _Bool +# else +# define bool unsigned char +/* Some compilers do not allow the use of unsigned char in bitfields. */ +# define BOOL_BITFIELD unsigned int +# endif + # undef true # undef false - -# define bool unsigned char # define true 1 # define false 0 - - /* Obsolete. */ -# define TRUE true -# define FALSE false #endif /* !__cplusplus */ -/* Some compilers do not allow the use of unsigned char in bitfields. */ -#define BOOL_BITFIELD unsigned int +/* Obsolete. */ +#undef TRUE +#undef FALSE +#define TRUE true +#define FALSE false /* As the last action in this file, we poison the identifiers that shouldn't be used. Note, luckily gcc-3.0's token-based integrated