[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AIX 4.3.3 IBM C compiler patch for m4-1.4.8
From: |
Paul Eggert |
Subject: |
Re: AIX 4.3.3 IBM C compiler patch for m4-1.4.8 |
Date: |
Sun, 04 Feb 2007 09:59:25 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Eric Blake <address@hidden> writes:
> If it is getting the gnulib bool, then we should figure out how to
> make the gnulib bool pick a type that will work for this usage
> pattern.
I don't know any way to do this. 'bool' must promote to int, so
the only plausible candidates that can be used for bit-fields are
int and signed int. But bool bitfields have a value 0 or 1, whereas
a signed bitfield has the value 0 or -1 (on two's complement hosts).
Admittedly this problem should be documented. Here's a proposed patch.
2007-02-04 Paul Eggert <address@hidden>
* lib/stdbool_.h: Mention that bool bit-fields aren't supported.
--- lib/stdbool_.h.~1.10.~ 2006-01-26 05:31:49.000000000 -0800
+++ lib/stdbool_.h 2007-02-04 09:53:04.000000000 -0800
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
Written by Bruno Haible <address@hidden>, 2001.
This program is free software; you can redistribute it and/or modify
@@ -41,6 +41,9 @@
- You cannot assume that _Bool is a typedef; it might be a macro.
+ - Bit-fields of type 'bool' are not supported. Portable code
+ should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
+
- In C99, casts and automatic conversions to '_Bool' or 'bool' are
performed in such a way that every nonzero value gets converted
to 'true', and zero gets converted to 'false'. This doesn't work