From: Jim Meyering Date: Mon, 28 Jul 2003 08:30:32 +0000 (+0000) Subject: (_Bool): Make it signed char, instead of X-Git-Tag: v5.0.90~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b70bf19ab4636ceec828b7678a3abf82652ab0c;p=thirdparty%2Fcoreutils.git (_Bool): Make it signed char, instead of an enum type, so that it's guaranteed to promote to int. --- diff --git a/lib/stdbool.hin b/lib/stdbool.hin index 69f6ef725f..f84c69fdd8 100644 --- a/lib/stdbool.hin +++ b/lib/stdbool.hin @@ -29,10 +29,14 @@ # undef true #endif -/* For the sake of symbolic names in gdb, define _Bool as an enum type. */ +/* For the sake of symbolic names in gdb, define true and false as + enum constants. However, do not define _Bool as the enum type, + since the enum type might be compatible with unsigned int, whereas + _Bool must promote to int. */ #ifndef __cplusplus # if !@HAVE__BOOL@ -typedef enum { false = 0, true = 1 } _Bool; +enum { false = 0, true = 1 }; +typedef signed char _Bool; # endif #else typedef bool _Bool;