| www.delorie.com/archives/browse.cgi | search |
| 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=n/uviXICnSt+Jq7vM8QXjrbY3BJQc6HY3vBou5fdguM=; | |
| b=KUMSxg5TE3lRc3kGCRKmYbZLuyG6UQqX39nSBXMS9Rt2IeLkHnPkNh7eilzYi7c/QS | |
| Pfokr4aNMm0FH6CWq24HNTBrrNJSTtQhGH3yx0QLrwfnxAsvWfbVc5P3P9cv40RVIwJV | |
| RD6cz8ArvtZbdmibSt1B1T3AIU9/qDe2ND231ARePkgvNjOuRFfxt6nJ6xKIxiIUvyxQ | |
| Hso/q3b7qjVae8tLS9Bvsls+3nlF9aPwPj1IY6JsvUqBgR28z+z8U2sBShtrVGfkSZcd | |
| TKDxmzJgPutPO8X2/wITmfzezBRrEfanVEfH/L5XAMC7ObEV0copARyaDe8iX/Gwu8MP | |
| sNkw== | |
| 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=n/uviXICnSt+Jq7vM8QXjrbY3BJQc6HY3vBou5fdguM=; | |
| b=lIgjnqVMdVqo2CYL49Rby32R+KbDiimMdmRH6a+3LvEC4FQF81qVqLLib6rdvQD0z3 | |
| Nti0xJOumB0V9hADrG2QccwgbuM6L2vdz44AFIbk53ADXP6CYFKBXfk5atcX810G1xFs | |
| 3k08wfI+GMUvdGdYlHs98GcMnTr4wwtrdVGbxN9jaVnCIf+6qtU5oMOOCXS/2sEdspPz | |
| GnH87evNndvQF0J/Ee0WIEfEAIrNre0wZ2TKRSGiEa1JyUHUrIP4zyW2IF1ZjGlFBrmf | |
| Oepp+qkDSoNg4cENGkFinRoUA+vGga9QO95GvQl/32wi5lK4GFngxtL4TOQOvnbzoZxN | |
| ft7g== | |
| X-Gm-Message-State: | APzg51DKTZgueCU49V/xWgLgkduhQrOynvwVJbK580ug8sy1FydttvMK |
| qroCgTd6VhisDMzUkD3bvuZ3qJrHvCSoMIlAloBdhqP6 | |
| X-Google-Smtp-Source: | ANB0VdYja1Yf35yUDJ8pCH0l6T98TtA3zNjHluUHpzTSGGc8pXOnQ8L4LAWsCg5vArZX7cLNTRGD9kb+q5m+EkQ+K7c= |
| X-Received: | by 2002:a6b:8cd6:: with SMTP id o205-v6mr12165463iod.195.1536952683229; |
| Fri, 14 Sep 2018 12:18:03 -0700 (PDT) | |
| MIME-Version: | 1.0 |
| In-Reply-To: | <CAA2C=vBs-=vUkC_4Ek96cnEPPg0=Dy_LMVM3ALOBThpe08CsYA@mail.gmail.com> |
| References: | <CAA2C=vBs-=vUkC_4Ek96cnEPPg0=Dy_LMVM3ALOBThpe08CsYA 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 22:18:02 +0300 |
| Message-ID: | <CAA2C=vAD0wRdTjgC1Xgj2LH2AmM7J7hJq=jCXjyhWHH5ou8q-Q@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:
> 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. (And the more recent versions gcc packages
> from current/v2gnu/ have it too, of course.) That makes our stdbool.h
> only useful for gcc2.95, but it is broken for it, because gcc2.95 does
> not define the _Bool type which we rely upon. (I don't know about the
> gcc2.95 C++ bool support, so I don't know whether our stdbool.h works
> with it.)
>
> I suggest we either remove it, or adjust it in a way so it only defines
> stuff for gcc < 3.0. Maybe (?) something like:
[...]
> Comments?
I obviously inlined a wrong patch. Saner one below:
diff -U 5 -r1.3 stdbool.h
--- stdbool.h 2 May 2015 07:31:48 -0000 1.3
+++ stdbool.h 14 Sep 2018 18:56:02 -0000
@@ -1,15 +1,21 @@
/* Copyright (C) 2012 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_stdbool__h_
#define __dj_stdbool__h_
+#if (__GNUC__ < 3)
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|| !defined(__STRICT_ANSI__) || defined(__cplusplus)
+typedef int _Bool;
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */
+#else
+#include_next <stdbool.h>
+#endif /* (__GNUC__ < 3) */
+
#endif /* !__dj_stdbool__h_ */
> I am writing this, because I just attempted building current cvs using
> gcc-2.95 and it failed in src/libc/dos/io/_open.c which added stdbool.h
> dependency in revision 1.13. The failure is unrecognized type _Bool,of
> course. For it, I suggest the following (like doprnt.c):
>
> diff -u -r1.13 _open.c
> --- _open.c 19 May 2018 18:01:03 -0000 1.13
> +++ _open.c 14 Sep 2018 18:57:21 -0000
> @@ -7,7 +7,6 @@
> /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
> #include <libc/stubs.h>
> #include <stdarg.h>
> -#include <stdbool.h>
> #include <string.h>
> #include <fcntl.h>
> #include <errno.h>
> @@ -19,6 +18,10 @@
> #include <sys/fsext.h>
> #include <libc/fsexthlp.h>
>
> +typedef enum {
> + false = 0, true = 1
> +} bool;
> +
> int
> _open(const char* filename, int oflag)
> {
>
> OK to apply?
--
O.S.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |