diff options
author | merrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4> | 1994-10-15 00:32:58 +0000 |
---|---|---|
committer | merrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4> | 1994-10-15 00:32:58 +0000 |
commit | 3ded4dec7c040e61a69af332a8508621f91f08a5 (patch) | |
tree | 31bd1143b29a49c1d148daff4bfefe4fbe918707 /gcc/cp/decl.c | |
parent | 83160bd071f14a6f97e86f0c26a7d7c60d8796ec (diff) | |
download | ppe42-gcc-3ded4dec7c040e61a69af332a8508621f91f08a5.tar.gz ppe42-gcc-3ded4dec7c040e61a69af332a8508621f91f08a5.zip |
(finish_enum): Disable code which forces enums to be signed,
since this conflicts with their use as bitfields. type_promotes_to
handles promotion of enums of underlying unsigned types to signed
integer types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8279 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b6b4f89d657..d4e04f05f51 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10282,9 +10282,20 @@ finish_enum (enumtype, values) if (! flag_short_enums && precision < TYPE_PRECISION (integer_type_node)) precision = TYPE_PRECISION (integer_type_node); + + /* + * The following code is unnecessary since the function + * type_promotes_to deals correctly with promotion of enums of + * underlying unsigned types to signed integer types. + * Moreover, it causes an enum bitfield to require one more bit of + * storage than defined by the ANSI/ISO C++ resolution section r.7.2 + * which defines the range of an enum. + */ +#if 0 /* Unlike the C frontend, we prefer signed types. */ if (unsignedp && int_fits_type_p (maxnode, type_for_size (precision, 0))) unsignedp = 0; +#endif TYPE_PRECISION (enumtype) = precision; TYPE_SIZE (enumtype) = NULL_TREE; |