delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2018/09/14/16:37:58

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20161025;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to;
bh=4ajuHfLk8El/5DughmBiNFsFESJPxIpyG0vRtC1Sufo=;
b=SAJJqeGp5IqrO+OZ7GgnRo8985UxLudY/LK89b4DDs6xAzNjYdAQPT1Ywm30Nr9XoE
GeB7NneP9NYAAWVce48U2K0iKWEl8EzQ6xL/jAZhDpWAIAg35RXe3/dgVoBUu5kCYPTO
t45yAoTAmGybt7/Gra/Zk1oEuP0Mq3AexcPw8TxrSFB12qsFxootX180AdYKR15VU+5V
Y6ib2WKaH+zKCTCrSi+/XZgI6CUA7rwFZuAk/CYMSkC+wZQhj3syl/NizmTRZSVjK0mN
iULxUquM8alrGB2YLK1GDCGE2XBZZnZqqA7tY5Kq37GZ77aF2nIJXwGWtZLAArwJcmT2
CZbQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to;
bh=4ajuHfLk8El/5DughmBiNFsFESJPxIpyG0vRtC1Sufo=;
b=N7/Iw+km+tFas24UheMZPy2eneJKiiU4Do77zShXQUFn+oN82D0vDD2tDWXCVvgwkv
+eRDQUfTPe6Ap6AMhl6f1s6dzvavY0mzSjm0XlmfxnPOzkDAdcXUejVpKSKVVuhFc4Bk
wFUCjh1/byJJpH+b9q8/o7WKZoFdrR+1pv5BOmhMJai53ZhPdpbzT5xdNjQ9R2NNRlCl
kAgz7tt75CQyKEiRjL/j1mel4OfdS84CPczQ+uNIK1RFd4LZ0z0GaED7CCgb2UH1OL9w
aobg/7BzUVznKGQ0zBdic6iUTEQ0WFqE9YWD/jye/FhIdOVtrTGEJX8kewz/ptxvlI2G
zusQ==
X-Gm-Message-State: APzg51BnQBasOQNsSPvtl5k0991FAqOkJSG2tI7VozMGgL/4F+QRlyg9
zRxGJ+Iq3ws44M4cjIufkHhvz/j4fZxSMkOP7Lp09nY3
X-Google-Smtp-Source: ANB0VdbABn6OAqt6xlkLk3wajOeO+JEGXDFXF0VdRPhBVR9MJ++vNttoGy5t5r9TFmCtjIqapfxK97pIqYr17b7nIBM=
X-Received: by 2002:a24:e904:: with SMTP id f4-v6mr3921019ith.19.1536957475630;
Fri, 14 Sep 2018 13:37:55 -0700 (PDT)
MIME-Version: 1.0
In-Reply-To: <CAA2C=vAcJ4O=LgH169woSzwKxNDGfNE-f4ipqh1j6=QDRyvxgw@mail.gmail.com>
References: <CAA2C=vBs-=vUkC_4Ek96cnEPPg0=Dy_LMVM3ALOBThpe08CsYA AT mail DOT gmail DOT com>
<83a7ojkfum DOT fsf AT gnu DOT org> <CAA2C=vCs5JmgWZEYuzBY7bdu-WMxURcqR+V-bb-GNcWVE6unmw AT mail DOT gmail DOT com>
<CAA2C=vAcJ4O=LgH169woSzwKxNDGfNE-f4ipqh1j6=QDRyvxgw AT mail DOT gmail DOT com>
From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp-workers AT delorie DOT com]" <djgpp-workers AT delorie DOT com>
Date: Fri, 14 Sep 2018 23:37:55 +0300
Message-ID: <CAA2C=vC3QjRNs_sLrQQSVKTKqY9L8gJ6+4uzyF_ceo6AOfGejA@mail.gmail.com>
Subject: Re: stdbool.h
To: djgpp-workers AT delorie DOT com
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 9/14/18, Ozkan Sezer <sezeroz AT gmail DOT com> wrote:
> On 9/14/18, Ozkan Sezer <sezeroz AT gmail DOT com> wrote:
>> On 9/14/18, Eli Zaretskii (eliz AT gnu DOT org) [via
>> djgpp-workers AT delorie DOT com] <djgpp-workers AT delorie DOT com> wrote:
>>>> From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp-workers AT delorie DOT com]"
>>>> <djgpp-workers AT delorie DOT com>
>>>> Date: Fri, 14 Sep 2018 21:58:26 +0300
>>>>
>>>> Why do we need to provide a stdbool.h among djgpp includes? Gcc >= 3.0
>>>> already provides it, and looking at deleted/v2gnu/ our own gcc302b.zip
>>>> and gcc31b.zip do have it.
>>>
>>> I may be misremembering or mixing things up (it's been a while), but
>>> could it have something to do with the "freestanding" support?
>>>
>>
>> That may be, yes.  In that case, it is still broken for gcc < 3.0
>
> I just tested building a test case like
> #include <stdbool.h>
> bool _foo = true;
>
> .. with
>   gcc -ffreestanding -Wall -W -c 0.c
>
> .. and it does not fail, i.e. gcc-provided stdbool.h is still available
> in -ffreestanding mode.
>

In any case, I suggest the patch below for stdbool.h.
Comments?

diff -u -r1.3 stdbool.h
--- stdbool.h	2 May 2015 07:31:48 -0000	1.3
+++ stdbool.h	14 Sep 2018 20:36:12 -0000
@@ -5,9 +5,21 @@
 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
   || !defined(__STRICT_ANSI__) || defined(__cplusplus)

+#if (__GNUC__ < 3)
+typedef unsigned char _Bool;
+#endif
+
+#if !defined(__cplusplus)
 #define bool _Bool
 #define true 1
 #define false 0
+#else
+#define _Bool bool
+#define bool bool
+#define false false
+#define true true
+#endif
+
 #define __bool_true_false_are_defined 1

 #endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019