bug-gnulib
[Top][All Lists]
Advanced

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

Re: proposed stdbool fixes for AIX, HP-UX, and now IRIX


From: Bruno Haible
Subject: Re: proposed stdbool fixes for AIX, HP-UX, and now IRIX
Date: Wed, 25 Jan 2006 14:58:47 +0100
User-agent: KMail/1.5

Paul Eggert wrote:
> The output (when compiling Bison) contained oodles of "An enumerated
> type is mixed with another type" diagnostics, because the compiler
> didn't like mixing int values like 0 and 1 (which "false" and "true"
> evaluated to) with bool values.  There were so many diagnostics, and
> they were formatted weirdly enough, that it was hard to find the real
> diagnostics that were more important.
> ...
> Here is a public message that talks about a similar problem with the
> SGI compilers:
>
> http://lists.gnu.org/archive/html/bug-textutils/2002-02/msg00020.html

Thanks, I'm applying the patch below. It tacifies IRIX cc.

> The obvious solution is to stop using enum for bool values.

I don't know what you will propose, but
  - "enum" is fundamentally the right concept for this; "enum" in C was
    introduced for exactly this kind of symbolic values,
  - Regarding the stdbool and stdint modules, I prefer an approach that
    doesn't break unrelated platforms. We have already invested some effort
    in these modules. I'm not interested in retesting it on platforms
    from Linux libc5 to HP-UX 10 to BeOS.

Bruno


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

        * stdbool_.h (_Bool) [IRIX cc]: Define as 'signed char', to avoid
        warnings.
        Reported by Paul Eggert.

*** stdbool_.h  24 Jan 2006 22:00:13 -0000      1.8
--- stdbool_.h  25 Jan 2006 13:52:11 -0000
***************
*** 90,97 ****
  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
  enum { false = 0, true = 1 };
  #  else
--- 90,100 ----
  enum { false = 0, true = 1 };
  #  endif
  # else
! #  if (defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)) || 
(defined __sgi && !defined __GNUC__)
!     /* With SunPRO C, avoid stupid
!          "warning: _Bool is a keyword in ISO C99".
!        With IRIX cc, avoid stupid
!          "warning(1185): enumerated type mixed with another type".  */
  #   define _Bool signed char
  enum { false = 0, true = 1 };
  #  else





reply via email to

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