Commit c149cc37 by Robert Lipe Committed by Robert Lipe

configure.in (ENUM_BITFIELDS_ARE_UNSIGNED): Added.

        * configure.in (ENUM_BITFIELDS_ARE_UNSIGNED): Added.  Check that
        bitfields of the host compiler are not signed quantities.
        * config.in: Regenerate.
        * configure: Regenerate.
        * system.h (USE_ENUM_BITFIELDS): Added.
        (ENUM_BITFIELDS): Added.
        * rtl.h (rtx_def): Members `code', `mode', now ENUM_BITFIELD.
        (SHORT_ENUM_BUG): Deleted.
        * tree.h (tree_common): Members `code', `mode', `built_in_class',
        now ENUM_BITFIELD.
        * config/i386/xm-sco.h (ONLY_INT_FIELDS): Deleted.
        (CODE_FIELD_BUG): Likewise.
        * config/m68k/x-apollo68 (CC): Deleted SHORT_ENUM_BUG.
        (OLD_CC): Likewise.
        * config/m68k/x-ccur (X_CFLAGS): Likewise.

From-SVN: r33233
parent aa4661f8
2000-04-18 Robert Lipe <robertlipe@usa.net>
* configure.in (ENUM_BITFIELDS_ARE_UNSIGNED): Added. Check that
bitfields of the host compiler are not signed quantities.
* config.in: Regenerate.
* configure: Regenerate.
* system.h (USE_ENUM_BITFIELDS): Added.
(ENUM_BITFIELDS): Added.
* rtl.h (rtx_def): Members `code', `mode', now ENUM_BITFIELD.
(SHORT_ENUM_BUG): Deleted.
* tree.h (tree_common): Members `code', `mode', `built_in_class',
now ENUM_BITFIELD.
* config/i386/xm-sco.h (ONLY_INT_FIELDS): Deleted.
(CODE_FIELD_BUG): Likewise.
* config/m68k/x-apollo68 (CC): Deleted SHORT_ENUM_BUG.
(OLD_CC): Likewise.
* config/m68k/x-ccur (X_CFLAGS): Likewise.
Tue Apr 18 14:16:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Tue Apr 18 14:16:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* ggc-common.c: Add missing blanks. * ggc-common.c: Add missing blanks.
......
...@@ -419,6 +419,9 @@ ...@@ -419,6 +419,9 @@
/* Define if you have the i library (-li). */ /* Define if you have the i library (-li). */
#undef HAVE_LIBI #undef HAVE_LIBI
/* Define if enumerated bitfields are treated as unsigned values. */
#undef ENUM_BITFIELDS_ARE_UNSIGNED
/* Define if mmap can get us zeroed pages from /dev/zero. */ /* Define if mmap can get us zeroed pages from /dev/zero. */
#undef HAVE_MMAP_ANYWHERE #undef HAVE_MMAP_ANYWHERE
......
...@@ -3,11 +3,3 @@ ...@@ -3,11 +3,3 @@
/* Big buffers improve performance. */ /* Big buffers improve performance. */
#define IO_BUFFER_SIZE (0x8000 - 1024) #define IO_BUFFER_SIZE (0x8000 - 1024)
#ifndef __GNUC__
/* The SCO compiler gets it wrong, and treats enumerated bitfields
as signed quantities, making it impossible to use an 8-bit enum
for compiling GNU C++. */
#define ONLY_INT_FIELDS 1
#define CODE_FIELD_BUG 1
#endif
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# vasta@apollo.com says this is how to compile on an Apollo (SR10.x). # vasta@apollo.com says this is how to compile on an Apollo (SR10.x).
# Use a Berkeley environment. # Use a Berkeley environment.
CC=cc -g -A nansi -A cpu,3000 -A runtype,bsd4.3 -A systype,any -DSHORT_ENUM_BUG CC=cc -g -A nansi -A cpu,3000 -A runtype,bsd4.3 -A systype,any
OLDCC=cc -g -A nansi -A cpu,3000 -A runtype,bsd4.3 -A systype,any -DSHORT_ENUM_BUG OLDCC=cc -g -A nansi -A cpu,3000 -A runtype,bsd4.3 -A systype,any
# This used to redefine CFLAGS and LIBGCC2_CFLAGS to eliminate the unsupported # This used to redefine CFLAGS and LIBGCC2_CFLAGS to eliminate the unsupported
# -g flag from both macros. This gives an undebuggable stage1 compiler which # -g flag from both macros. This gives an undebuggable stage1 compiler which
......
# Specify the jobs library when building in the ATT universe. # Specify the jobs library when building in the ATT universe.
CLIB = -ljobs CLIB = -ljobs
X_CFLAGS = -O0 -DSHORT_ENUM_BUG -Dregister= X_CFLAGS = -O0 -Dregister=
...@@ -377,6 +377,27 @@ if test $gcc_cv_header_inttypes_h = yes; then ...@@ -377,6 +377,27 @@ if test $gcc_cv_header_inttypes_h = yes; then
AC_DEFINE(HAVE_INTTYPES_H) AC_DEFINE(HAVE_INTTYPES_H)
fi fi
#
# Determine if enumerated bitfields are unsigned. ISO C says they can
# be either signed or unsigned.
#
AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
[AC_TRY_RUN(#include <stdlib.h>
enum t { BLAH = 128 } ;
struct s_t { enum t member : 8; } s ;
int main(void)
{
s.member = BLAH;
if (s.member < 0) exit(1);
exit(0);
}, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
AC_MSG_RESULT($gcc_cv_enum_bf_unsigned)
if test $gcc_cv_enum_bf_unsigned = yes; then
AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
[Define if enumerated bitfields are treated as unsigned values.])
fi
AC_CHECK_FUNCS(strtoul bsearch putenv popen bcopy bzero bcmp \ AC_CHECK_FUNCS(strtoul bsearch putenv popen bcopy bzero bcmp \
index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \ index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \ sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \
......
...@@ -103,23 +103,12 @@ typedef union rtunion_def ...@@ -103,23 +103,12 @@ typedef union rtunion_def
typedef struct rtx_def typedef struct rtx_def
{ {
#ifdef ONLY_INT_FIELDS
#ifdef CODE_FIELD_BUG
unsigned int code : 16;
#else
unsigned short code;
#endif
#else
/* The kind of expression this is. */ /* The kind of expression this is. */
enum rtx_code code : 16; ENUM_BITFIELD(rtx_code) code: 16;
#endif
/* The kind of value the expression has. */ /* The kind of value the expression has. */
#ifdef ONLY_INT_FIELDS ENUM_BITFIELD(machine_mode) mode : 8;
int mode : 8;
#else
enum machine_mode mode : 8;
#endif
/* 1 in an INSN if it can alter flow of control /* 1 in an INSN if it can alter flow of control
within this function. within this function.
LINK_COST_ZERO in an INSN_LIST. */ LINK_COST_ZERO in an INSN_LIST. */
...@@ -189,13 +178,8 @@ typedef struct rtx_def ...@@ -189,13 +178,8 @@ typedef struct rtx_def
/* Define macros to access the `code' field of the rtx. */ /* Define macros to access the `code' field of the rtx. */
#ifdef SHORT_ENUM_BUG
#define GET_CODE(RTX) ((enum rtx_code) ((RTX)->code))
#define PUT_CODE(RTX, CODE) ((RTX)->code = ((short) (CODE)))
#else
#define GET_CODE(RTX) ((RTX)->code) #define GET_CODE(RTX) ((RTX)->code)
#define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE)) #define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
#endif
#define GET_MODE(RTX) ((RTX)->mode) #define GET_MODE(RTX) ((RTX)->mode)
#define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE)) #define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
......
...@@ -547,4 +547,16 @@ extern void abort PARAMS ((void)); ...@@ -547,4 +547,16 @@ extern void abort PARAMS ((void));
/* Get libiberty declarations. */ /* Get libiberty declarations. */
#include "libiberty.h" #include "libiberty.h"
/* Enumerated bitfields are safe to use unless we've been explictly told
* otherwise or if they are signed. */
#define USE_ENUM_BITFIELDS __GNUC__ || (!ONLY_INT_FIELDS && ENUM_BTIFIELDS_ARE_UNSIGNED)
#if USE_ENUM_BITFIELDS
#define ENUM_BITFIELD(TYPE) enum TYPE
#else
#define ENUM_BITFIELD(TYPE) unsigned int
#endif
#endif /* __GCC_SYSTEM_H__ */ #endif /* __GCC_SYSTEM_H__ */
...@@ -126,12 +126,7 @@ struct tree_common ...@@ -126,12 +126,7 @@ struct tree_common
{ {
union tree_node *chain; union tree_node *chain;
union tree_node *type; union tree_node *type;
#ifdef ONLY_INT_FIELDS ENUM_BITFIELD(tree_code) code : 8;
unsigned int code : 8;
#else
enum tree_code code : 8;
#endif
unsigned side_effects_flag : 1; unsigned side_effects_flag : 1;
unsigned constant_flag : 1; unsigned constant_flag : 1;
unsigned permanent_flag : 1; unsigned permanent_flag : 1;
...@@ -906,11 +901,7 @@ struct tree_type ...@@ -906,11 +901,7 @@ struct tree_type
unsigned int uid; unsigned int uid;
unsigned int precision : 9; unsigned int precision : 9;
#ifdef ONLY_INT_FIELDS ENUM_BITFIELD(machine_mode) mode : 7;
unsigned int mode : 7;
#else
enum machine_mode mode : 7;
#endif
unsigned string_flag : 1; unsigned string_flag : 1;
unsigned no_force_blk_flag : 1; unsigned no_force_blk_flag : 1;
...@@ -1394,11 +1385,7 @@ struct tree_decl ...@@ -1394,11 +1385,7 @@ struct tree_decl
unsigned malloc_flag : 1; unsigned malloc_flag : 1;
unsigned no_limit_stack : 1; unsigned no_limit_stack : 1;
unsigned pure_flag : 1; unsigned pure_flag : 1;
#ifdef ONLY_INT_FIELDS ENUM_BITFIELD(built_in_class) built_in_class : 2;
unsigned int built_in_class : 2;
#else
enum built_in_class built_in_class : 2;
#endif
unsigned lang_flag_0 : 1; unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1; unsigned lang_flag_1 : 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment