Fix a bug occurring with HP-UX aCC compiler.
authorBruno Haible <bruno@clisp.org>
Tue, 24 Jan 2006 22:00:13 +0000 (22:00 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 24 Jan 2006 22:00:13 +0000 (22:00 +0000)
lib/ChangeLog
lib/stdbool_.h

index c3f544ab1413b9d0309d94130d2deca6d5c581a8..66f8fa7512d5a1d1b150ca04220a7b808905391f 100644 (file)
@@ -1,5 +1,10 @@
 2006-01-24  Bruno Haible  <bruno@clisp.org>
 
+       * stdbool_.h (_Bool) [__cplusplus]: Don't define if the compiler already
+       has it.
+       Report and patch by Albert Chin-A-Young  <china@thewrittenword.com> on
+       2005-11-26.
+
        * stdbool_.h (_Bool) [HP-UX cc, AIX cc,xlc] : Define as 'signed char'
        to avoid problems with the built-in _Bool type.
        Reported by Paul Eggert on 2005-11-26.
index 586b5c71733290d36297c857a7d16ee33ae291ea..db16581a2f824ec74ca705a8676a474f4de0e68d 100644 (file)
    (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
    (see ISO C 99 6.3.1.1.(2)).  So we add a negative value to the
    enum; this ensures that '_Bool' promotes to 'int'.  */
-#if !(defined __cplusplus || defined __BEOS__)
+#if defined __cplusplus || defined __BEOS__
+  /* A compiler known to have 'bool'.  */
+  /* If the compiler already has both 'bool' and '_Bool', we can assume they
+     are the same types.  */
+# if !@HAVE__BOOL@
+typedef bool _Bool;
+# endif
+#else
 # if @HAVE__BOOL@
 #  if defined __HP_cc || defined __xlc__
     /* Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
@@ -91,8 +98,6 @@ enum { false = 0, true = 1 };
 typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
 #  endif
 # endif
-#else
-typedef bool _Bool;
 #endif
 #define bool _Bool