bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] Re: lib/stdbool_.h doesn't honor HAVE__BOOL


From: Bruno Haible
Subject: Re: [bug-gnulib] Re: lib/stdbool_.h doesn't honor HAVE__BOOL
Date: Tue, 24 Jan 2006 22:36:20 +0100
User-agent: KMail/1.5

Paul Eggert wrote on 2005-11-26:
> Unfortunately that isn't enough to fix the stdbool module problems
> we've been running into recently with coreutils.  They include:
>
> Some HP-UX C compilers mishandle _Bool (internal compiler error),
> independently of whether <stdbool.h> works.  E.g.,
> <http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html>,
> <http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html>.
>
> IBM C compiler mishandles sign-extension when combining _Bool with int. 
> E.g.,
> <http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html>.
>
> Some of the complexity of stdbool_.h is due to the desire to debug
> bool variables nicely with GDB, when you are using an older compiler
> that doesn't have a working <stdbool.h>.  That motivation is becoming
> more and more obsolescent these days, though, since most developers
> these days use compilers that support <stdbool.h>.  So I propose that
> we drop this as a goal for stdbool_.h.

Hmm, I'm not inclined to drop debuggability on platforms using gcc-2.95
or similar (such as OpenBSD 3.6), just for HP-UX and AIX compiler bugs.
I'm therefore applying the following minimal-change, punish-only-the-
broken-ones, patch.

Bruno


2006-01-24  Bruno Haible  <address@hidden>

        * 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.

*** stdbool_.h  14 May 2005 06:03:58 -0000      1.6
--- stdbool_.h  24 Jan 2006 21:42:46 -0000
***************
*** 1,4 ****
! /* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
     Written by Bruno Haible <address@hidden>, 2001.
  
     This program is free software; you can redistribute it and/or modify
--- 1,4 ----
! /* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
     Written by Bruno Haible <address@hidden>, 2001.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 71,77 ****
     (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 address@hidden@
  #  if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)
      /* Avoid stupid "warning: _Bool is a keyword in ISO C99".  */
  #   define _Bool signed char
--- 71,88 ----
     (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 @HAVE__BOOL@
! #  if defined __HP_cc || defined __xlc__
!     /* Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
!        the built-in _Bool type is used.  See
!          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
!          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
!          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
!        Override it.  */
! #   define _Bool signed char
! enum { false = 0, true = 1 };
! #  endif
! # else
  #  if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)
      /* Avoid stupid "warning: _Bool is a keyword in ISO C99".  */
  #   define _Bool signed char





reply via email to

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