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
This commit is contained in:
Robert Lipe 2000-04-18 19:42:30 +00:00 committed by Robert Lipe
parent aa4661f823
commit c149cc37c8
10 changed files with 273 additions and 197 deletions

View File

@ -1,3 +1,21 @@
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>
* ggc-common.c: Add missing blanks.

View File

@ -419,6 +419,9 @@
/* Define if you have the i library (-li). */
#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. */
#undef HAVE_MMAP_ANYWHERE

View File

@ -3,11 +3,3 @@
/* Big buffers improve performance. */
#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

View File

@ -2,8 +2,8 @@
# vasta@apollo.com says this is how to compile on an Apollo (SR10.x).
# Use a Berkeley environment.
CC=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 -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
# This used to redefine CFLAGS and LIBGCC2_CFLAGS to eliminate the unsupported
# -g flag from both macros. This gives an undebuggable stage1 compiler which

View File

@ -1,3 +1,3 @@
# Specify the jobs library when building in the ATT universe.
CLIB = -ljobs
X_CFLAGS = -O0 -DSHORT_ENUM_BUG -Dregister=
X_CFLAGS = -O0 -Dregister=

361
gcc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -377,6 +377,27 @@ if test $gcc_cv_header_inttypes_h = yes; then
AC_DEFINE(HAVE_INTTYPES_H)
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 \
index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \

View File

@ -103,23 +103,12 @@ typedef union rtunion_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. */
enum rtx_code code : 16;
#endif
ENUM_BITFIELD(rtx_code) code: 16;
/* The kind of value the expression has. */
#ifdef ONLY_INT_FIELDS
int mode : 8;
#else
enum machine_mode mode : 8;
#endif
ENUM_BITFIELD(machine_mode) mode : 8;
/* 1 in an INSN if it can alter flow of control
within this function.
LINK_COST_ZERO in an INSN_LIST. */
@ -189,13 +178,8 @@ typedef struct rtx_def
/* 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 PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
#endif
#define GET_MODE(RTX) ((RTX)->mode)
#define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))

View File

@ -547,4 +547,16 @@ extern void abort PARAMS ((void));
/* Get libiberty declarations. */
#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__ */

View File

@ -126,12 +126,7 @@ struct tree_common
{
union tree_node *chain;
union tree_node *type;
#ifdef ONLY_INT_FIELDS
unsigned int code : 8;
#else
enum tree_code code : 8;
#endif
ENUM_BITFIELD(tree_code) code : 8;
unsigned side_effects_flag : 1;
unsigned constant_flag : 1;
unsigned permanent_flag : 1;
@ -906,11 +901,7 @@ struct tree_type
unsigned int uid;
unsigned int precision : 9;
#ifdef ONLY_INT_FIELDS
unsigned int mode : 7;
#else
enum machine_mode mode : 7;
#endif
ENUM_BITFIELD(machine_mode) mode : 7;
unsigned string_flag : 1;
unsigned no_force_blk_flag : 1;
@ -1394,11 +1385,7 @@ struct tree_decl
unsigned malloc_flag : 1;
unsigned no_limit_stack : 1;
unsigned pure_flag : 1;
#ifdef ONLY_INT_FIELDS
unsigned int built_in_class : 2;
#else
enum built_in_class built_in_class : 2;
#endif
ENUM_BITFIELD(built_in_class) built_in_class : 2;
unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1;