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

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:from:date:message-id:subject:to;
bh=4vH6VV7bpdyFEaJJcsIOMM6zZpgkI/0FeGM97BSWvvs=;
b=k/dc+IsluW/Wdtt2yiOyKUaD/+WXQ/xaNbRK6fQmtqXVdz3FXYuUcnukQijDHsF3W+
5v3LEnk9KUPbQQ8eRjEYZGo1P3Fap1y31NzX9PkjwRWQ9rgwO8OCRFHGaCg+HWJlN/z8
qpFa5nxzujnJ3Yu1JkFhcJtALeTULstfnOiSHh+j4HGS49t7D3bA3L8rdpki3rXkWHXS
s54S8Po6De1C+USCjQ5E6/jTrrxdS+haB9s1T/ahSfCaX3DvGaDtEY92V83A7suuxdq5
A7Viu3q+/SS0c6s6y9KYToebEm3qfVLYBsFDuRge2Rq0408ohHBxHbwv2xUIlQgYIOD4
mOwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=4vH6VV7bpdyFEaJJcsIOMM6zZpgkI/0FeGM97BSWvvs=;
b=dSvPK8fjm6Bh3BoPLYzhQ8TMY5zOdmIV1Sso0cjJ3fMys/f8INb2RCWMzQ4PpfgEIh
bdDPx92/4/ZK8ya2+76RoLU55zymLNqjmlIL8d1C6szbMNBXkd/s6Rfa5J0pjHZrCoVb
CraCZLpEGRtollrmpLX5qtRdHY4/yxKjaBMgOsdJeNvgr1y+5mBiHo1elAU3aXEFVIyH
z0bpzzy/dvVucJmNgVZ3V8AnHALqJZmfLUuO0Qme/Q82ZU8YSVNT9xawvuZS+aJ3lEkE
i0lJdj6LcXX2vU+gYAoxYsBZuyND+dP3tBf+aSmrcG1f500khlHbNgcJcywzstw/703f
mz8A==
X-Gm-Message-State: APzg51Dhl3nB9Ish9JRs0MkfjiCP6Z1qTj4gDAtr21R5XA3gcKp85cM6
UmTzSjVVpeXKUsRO64/OJc+ptTljcpISmJNMaMXqgG0l
X-Google-Smtp-Source: ANB0VdYo3bVahOvV80cRY2VNNFsLvnAMSOvSVAKJa+7WhJ7woTqc0zgF8YTnWVUODQKuQaU+k217J9xuJHoldKFhviI=
X-Received: by 2002:a24:17d2:: with SMTP id 201-v6mr3848552ith.0.1536951506666;
Fri, 14 Sep 2018 11:58:26 -0700 (PDT)
MIME-Version: 1.0
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
Message-ID: <CAA2C=vBs-=vUkC_4Ek96cnEPPg0=Dy_LMVM3ALOBThpe08CsYA@mail.gmail.com>
Subject: stdbool.h
To: djgpp-workers AT delorie DOT com
Reply-To: djgpp-workers AT delorie DOT com

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:

diff -U 5 -r1.3 stdbool.h
--- stdbool.h	2 May 2015 07:31:48 -0000	1.3
+++ stdbool.h	14 Sep 2018 18:52:36 -0000
@@ -1,15 +1,20 @@
 /* Copyright (C) 2012 DJ Delorie, see COPYING.DJ for details */
 #ifndef __dj_stdbool__h_
 #define __dj_stdbool__h_

+#if (__GNUC__ < 3)
+#include_next <stdbool.h>
+#else
+
 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
   || !defined(__STRICT_ANSI__) || defined(__cplusplus)

 #define bool _Bool
 #define true 1
 #define false 0
 #define __bool_true_false_are_defined 1

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

+#endif /* (__GNUC__ < 3) */
 #endif /* !__dj_stdbool__h_ */


Comments?


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.

- Raw text -


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