delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/05/23/04:50:29

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=hbaB8GtLUTZCZQWrZLPQ16Yl1cJJJzdcNEyDHtdpwJA=;
b=GHe+9z327ATNlyUioPanwxIany7CbWVfyKfgSF6jhRxQvosaYrgjRSowzfFkIEbISH
r4djwr0kqzyu7ZU4xQQ2HU2cV/vWBg5DPu05wM4KKbGkFGpFXXBuq9FhL1MqoJ5Lzymf
UKd+OkdzjIa9i+MW/FlZcc6ZYTQFhJjJLPD+XMHQsFyrZdY5BLFiJQT36uXTF6HTr17v
camHeyyYarM7nsTkpxG+hxEytNS+cAcKvjwS0QrmxZsMsdtsF4IeL/1K8tL2o7ivXbkR
tvIpGYFJW2++xaFmPsyn7RK9+YFEUIHurOcy3ZrgpX8feyGEvU1hZH1MEwZqR+up6Hiw
iqlg==
MIME-Version: 1.0
X-Received: by 10.50.78.100 with SMTP id a4mr10751843igx.34.1432371016746;
Sat, 23 May 2015 01:50:16 -0700 (PDT)
In-Reply-To: <201505042003.t44K3odg011007@delorie.com>
References: <201505042003 DOT t44K3odg011007 AT delorie DOT com>
Date: Sat, 23 May 2015 11:50:16 +0300
Message-ID: <CAA2C=vCqxf5tWphc44122NxtGb3v7P97BmjjpWkMYqfe1SfXiw@mail.gmail.com>
Subject: Re: ANNOUNCE: DJGPP 2.05 beta 1
From: "Ozkan Sezer (sezeroz AT gmail DOT com)" <djgpp AT delorie DOT com>
To: djgpp AT delorie DOT com
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Applied the following in order to avoid stdbool.h usage:
As I stated earlier in this thread our stdbool.h is broken
(and gcc provides its stdbool.h) and it leads to failures
such as:

cc1.exe: warnings being treated as errors
doscan.c:38: warning: type defaults to `int' in declaration of `_Bool'
doscan.c:38: parse error before `allocate_char_buffer'
doscan.c:38: warning: function declaration isn't a prototype
doscan.c:41: warning: type defaults to `int' in declaration of `_Bool'
doscan.c:41: parse error before `allocate_char_buffer'
doscan.c:41: warning: function declaration isn't a prototype
doscan.c: In function `_doscan_low':
doscan.c:71: `_Bool' undeclared (first use in this function)

---

* doprnt.c, doscan.c: locally define bool/false/true and remove the
  stdbool.h usage.

* libc/ansi/time/strftime.c: revert parts of r1.8 and simply use 0
  and 1 instead of true and false again.

* djtar/unbzip2.c: revert parts of r1.4 and go back to the original
  TRUE and FALSE usage.

* tests/libc/c99/math/t-ismac.c: locally define bool/false/true and
  remove stdbool.h usage.

Index: src/libc/ansi/stdio/doprnt.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doprnt.c,v
retrieving revision 1.36
diff -u -p -r1.36 doprnt.c
--- src/libc/ansi/stdio/doprnt.c	10 Jan 2014 18:21:56 -0000	1.36
+++ src/libc/ansi/stdio/doprnt.c	13 May 2015 08:02:10 -0000
@@ -21,12 +21,15 @@
 #include <string.h>
 #include <math.h>
 #include <limits.h>
-#include <stdbool.h>
 #include <libc/file.h>
 #include <libc/local.h>
 #include <libc/ieee.h>
 #include <sys/cdefs.h>

+typedef enum {
+  false = 0, true = 1
+} bool;
+
 static char decimal_point;
 static char thousands_sep;
 static char *grouping;
Index: src/libc/ansi/stdio/doscan.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/doscan.c,v
retrieving revision 1.24
diff -u -p -r1.24 doscan.c
--- src/libc/ansi/stdio/doscan.c	2 May 2015 07:32:04 -0000	1.24
+++ src/libc/ansi/stdio/doscan.c	13 May 2015 08:02:10 -0000
@@ -12,12 +12,15 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <locale.h>
-#include <stdbool.h>
 #include <stddef.h>
 #include <errno.h>
 #include <libc/file.h>
 #include <libc/local.h>

+typedef enum {
+  false = 0, true = 1
+} bool;
+
 #define SPC               01
 #define STP               02


Index: src/libc/ansi/time/strftime.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/time/strftime.c,v
retrieving revision 1.10
diff -u -p -r1.10 strftime.c
--- src/libc/ansi/time/strftime.c	2 May 2015 07:32:14 -0000	1.10
+++ src/libc/ansi/time/strftime.c	13 May 2015 08:03:02 -0000
@@ -9,7 +9,6 @@
 #include <string.h>
 #include <time.h>
 #include <ctype.h>
-#include <stdbool.h>


 #define THURSDAY       4
@@ -164,21 +163,21 @@ _fmt(const char *format, const struct tm
   {
     if (*format == '%')
     {
-      int flag_seen, pad = '0', space=' ', swap_case = false;
+      int flag_seen, pad = '0', space=' ', swap_case = 0;

       /*  Parse flags.  */
       do {
-        flag_seen = false;
+        flag_seen = 0;
         if (format[1] == '_')
-          flag_seen = true, pad = space = ' ', format++;
+          flag_seen = 1, pad = space = ' ', format++;
         if (format[1] == '-')
-          flag_seen = true, pad = space = 0, format++;
+          flag_seen = 1, pad = space = 0, format++;
         if (format[1] == '0')
-          flag_seen = true, pad = space = '0', format++;
+          flag_seen = 1, pad = space = '0', format++;
         if (format[1] == '^')
-          flag_seen = true, upcase = true, format++;
+          flag_seen = 1, upcase = 1, format++;
         if (format[1] == '#')
-          flag_seen = true, swap_case = true, format++;
+          flag_seen = 1, swap_case = 1, format++;
       } while (flag_seen);

       /*  Parse modifiers.  */
@@ -192,7 +191,7 @@ _fmt(const char *format, const struct tm
 	break;
       case 'A':
 	if (swap_case)
-	  upcase = true;
+	  upcase = 1;
 	if (t->tm_wday < 0 || t->tm_wday > 6)
 	  return 0;
 	if (!_add(Afmt[t->tm_wday], upcase))
@@ -200,7 +199,7 @@ _fmt(const char *format, const struct tm
 	continue;
       case 'a':
 	if (swap_case)
-	  upcase = true;
+	  upcase = 1;
 	if (t->tm_wday < 0 || t->tm_wday > 6)
 	  return 0;
 	if (!_add(afmt[t->tm_wday], upcase))
@@ -208,7 +207,7 @@ _fmt(const char *format, const struct tm
 	continue;
       case 'B':
 	if (swap_case)
-	  upcase = true;
+	  upcase = 1;
 	if (t->tm_mon < 0 || t->tm_mon > 11)
 	  return 0;
 	if (!_add(Bfmt[t->tm_mon], upcase))
@@ -217,7 +216,7 @@ _fmt(const char *format, const struct tm
       case 'b':
       case 'h':
 	if (swap_case)
-	  upcase = true;
+	  upcase = 1;
 	if (t->tm_mon < 0 || t->tm_mon > 11)
 	  return 0;
 	if (!_add(bfmt[t->tm_mon], upcase))
@@ -294,7 +293,7 @@ _fmt(const char *format, const struct tm
 	  return 0;
 	continue;
       case 'p':
-	upcase = swap_case ? false : true;
+	upcase = swap_case ? 0 : 1;
 	if (!_add(t->tm_hour >= 12 ? "pm" : "am", upcase))
 	  return 0;
 	continue;
@@ -381,7 +380,7 @@ _fmt(const char *format, const struct tm
 	  strcpy(tm_zone, t->tm_zone);
 	  if (swap_case)
 	  {
-	    upcase = false;
+	    upcase = 0;
 	    strlwr(tm_zone);
 	  }
 	  if (!_add(tm_zone, upcase))
@@ -418,7 +417,7 @@ strftime(char *s, size_t maxsize, const
   pt = s;
   if ((gsize = maxsize) < 1)
     return 0;
-  if (_fmt(format, t, false))
+  if (_fmt(format, t, 0))
   {
     *pt = '\0';
     return maxsize - gsize;

Index: src/utils/djtar/unbzip2.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/utils/djtar/unbzip2.c,v
retrieving revision 1.5
diff -u -p -r1.5 unbzip2.c
--- src/utils/djtar/unbzip2.c	9 Jan 2011 14:19:57 -0000	1.5
+++ src/utils/djtar/unbzip2.c	13 May 2015 08:03:28 -0000
@@ -2,17 +2,19 @@
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */

-/*
+/*
  * This file provides bzip2 support for DJTAR.
  */


 #include <stdlib.h>
-#include <stdbool.h>
 #include "oread.h"
 #include "zread.h"
 #include "unbzip2.h"

+#define FALSE 0
+#define TRUE  1
+
 local int read_stream (void)
 {
   int bytes_in, bytes_read;
@@ -39,21 +41,21 @@ local int read_stream (void)
     if ((bzip_status) == BZ_OK && nbytes == EOF &&                \
         data->avail_in == 0 && data->avail_out > 0)               \
       goto error_handler;                                         \
-  } while (false)
+  } while (FALSE)

 #define CHECK_IF_BZ_STREAM_END_IS_EOF(buf)                        \
   do {                                                            \
     if ((buf)[0] == 'B' && (buf)[1] == 'Z' && (buf)[2] == 'h')    \
-      EOF_reached = false;                                        \
+      EOF_reached = FALSE;                                        \
     else                                                          \
-      EOF_reached = true;                                         \
-  } while (false)
+      EOF_reached = TRUE;                                         \
+  } while (FALSE)

 int unbzip2 (void *f)
 {
   bz_stream* data = NULL;
   int        bzip_status;
-  int        EOF_reached = true;
+  int        EOF_reached = TRUE;
   int        small = 0;      /* Use fast decompressing algorithm. */
   int        verbosity = 0;  /* No verbose output at all. */
   int        nbytes = 0;
@@ -79,7 +81,7 @@ int unbzip2 (void *f)
     goto error_handler;

   /* Decompress every stream (.bz2 file) contained in this file. */
-  while (true)
+  while (TRUE)
   {
     /* Decompress the actual stream (.bz2 file) contained in this file. */
     while (bzip_status == BZ_OK)

Index: tests/libc/c99/math/t-ismac.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/c99/math/t-ismac.c,v
retrieving revision 1.1
diff -u -p -r1.1 t-ismac.c
--- tests/libc/c99/math/t-ismac.c	23 Mar 2013 11:58:58 -0000	1.1
+++ tests/libc/c99/math/t-ismac.c	13 May 2015 08:04:50 -0000
@@ -1,10 +1,12 @@
 #include "../../../../include/stdio.h"
 #include "../../../../include/math.h"
 #include "../../../../include/libc/ieee.h"
-#include <stdbool.h>

 #define TEST_TYPE  0  /* Allowed 0 or 1 */

+typedef enum {
+  false = 0, true = 1
+} bool;

 typedef union
 {

- Raw text -


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