bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] stdbool-tests: accomodate Haiku


From: Eric Blake
Subject: [PATCH] stdbool-tests: accomodate Haiku
Date: Wed, 19 Jan 2011 08:36:16 -0700

* tests/test-stdbool.c: Haiku's gcc 2.95 lacks native _Bool.

Signed-off-by: Eric Blake <address@hidden>
---

Haiku is still stuck on gcc 2.95.3!  There's work underway to
upgrade to gcc 4, but the conversion is not complete.  Gcc 2.95
supplies a <stdbool.h> that typedefs _Bool as unsigned char,
rather than having it as an actual builtin type.

[And yes, I just installed Haiku in a virtual machine, to make
it easy to test all these recent fixes - it was surprisingly
easy; in fact, the installation was more pleasant than MirBSD.]

 ChangeLog            |    3 +++
 tests/test-stdbool.c |    8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6cf52b7..a9f6fb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-01-19  Eric Blake  <address@hidden>

+       stdbool-tests: accomodate Haiku
+       * tests/test-stdbool.c: Haiku's gcc 2.95 lacks native _Bool.
+
        binary-io: fix O_TEXT on Haiku
        * modules/binary-io (Depends-on): Add fcntl-h.
        * lib/binary-io.h (O_TEXT): Rely on replacement <fcntl.h> rather
diff --git a/tests/test-stdbool.c b/tests/test-stdbool.c
index 12b4fe8..e115ba2 100644
--- a/tests/test-stdbool.c
+++ b/tests/test-stdbool.c
@@ -52,14 +52,14 @@

 /* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at
    least, not for all compilers and compiler options.  */
-#if HAVE_STDBOOL_H || defined __GNUC__
+#if HAVE_STDBOOL_H || 3 <= __GNUC__
 struct s { _Bool s: 1; _Bool t; } s;
 #endif

 char a[true == 1 ? 1 : -1];
 char b[false == 0 ? 1 : -1];
 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-#if HAVE_STDBOOL_H || defined __GNUC__ /* See above.  */
+#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above.  */
 char d[(bool) 0.5 == true ? 1 : -1];
 # ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning.  */
 /* C99 may plausibly be interpreted as not requiring support for a cast from
@@ -73,7 +73,7 @@ char f[(_Bool) 0.0 == false ? 1 : -1];
 #endif
 char g[true];
 char h[sizeof (_Bool)];
-#if HAVE_STDBOOL_H || defined __GNUC__ /* See above.  */
+#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above.  */
 char i[sizeof s.t];
 #endif
 enum { j = false, k = true, l = false * true, m = true * 256 };
@@ -92,7 +92,7 @@ main ()
 {
   int error = 0;

-#if HAVE_STDBOOL_H || defined __GNUC__ /* See above.  */
+#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above.  */
 # ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning.  */
   /* A cast from a variable's address to bool is valid in expressions.  */
   {
-- 
1.7.3.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]