From: Kazu Hirata Date: Mon, 23 Feb 2004 14:10:58 +0000 (+0000) Subject: Makefile.in (opts.o): Depend on target.h. X-Git-Tag: releases/gcc-4.0.0~9922 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=221ee7c920c3eb45da77f01f82c4611798473fcf;p=thirdparty%2Fgcc.git Makefile.in (opts.o): Depend on target.h. * Makefile.in (opts.o): Depend on target.h. * opts.c (decode_options): Use targetm.default_short_enums instead of DEFAULT_SHORT_ENUMS. * system.h (DEFAULT_SHORT_ENUMS): Poison. * target-def.h (TARGET_DEFAULT_SHORT_ENUMS): New. (TARGET_INITIALIZER): Add TARGET_DEFAULT_SHORT_ENUMS. * target.h (gcc_target): Add default_short_enums. * config/cris/cris.h: Remove a comment about DEFAULT_SHORT_ENUMS. * config/ip2k/ip2k.h: Likewise. * doc/tm.texi (DEFAULT_SHORT_ENUMS): Change to TARGET_DEFAULT_SHORT_ENUMS. Update the description. From-SVN: r78303 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e73f7b22795a..17ee9e2c9e78 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2004-02-23 Kazu Hirata + + * Makefile.in (opts.o): Depend on target.h. + * opts.c (decode_options): Use targetm.default_short_enums + instead of DEFAULT_SHORT_ENUMS. + * system.h (DEFAULT_SHORT_ENUMS): Poison. + * target-def.h (TARGET_DEFAULT_SHORT_ENUMS): New. + (TARGET_INITIALIZER): Add TARGET_DEFAULT_SHORT_ENUMS. + * target.h (gcc_target): Add default_short_enums. + * config/cris/cris.h: Remove a comment about + DEFAULT_SHORT_ENUMS. + * config/ip2k/ip2k.h: Likewise. + * doc/tm.texi (DEFAULT_SHORT_ENUMS): Change to + TARGET_DEFAULT_SHORT_ENUMS. Update the description. + 2004-02-23 Eric Botcazou Falk Hueffner diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 0c1b23cb8b5b..f394b5f66af9 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1524,7 +1524,7 @@ diagnostic.o : diagnostic.c $(DIAGNOSTIC_H) real.h \ input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H) opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(RTL_H) \ - output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h + output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h target.h targhooks.o : targhooks.c targhooks.h $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(TM_H) $(RTL_H) $(TM_P_H) function.h \ output.h toplev.h diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 5110f9adbfb9..10147b272590 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -567,8 +567,6 @@ extern int target_flags; /* For compatibility and historical reasons, a char should be signed. */ #define DEFAULT_SIGNED_CHAR 1 -/* No DEFAULT_SHORT_ENUMS, please. */ - /* Note that WCHAR_TYPE_SIZE is used in cexp.y, where TARGET_SHORT is not available. */ #undef WCHAR_TYPE diff --git a/gcc/config/ip2k/ip2k.h b/gcc/config/ip2k/ip2k.h index 6457e8bb3eff..4685d030c1c0 100644 --- a/gcc/config/ip2k/ip2k.h +++ b/gcc/config/ip2k/ip2k.h @@ -108,12 +108,6 @@ extern int target_flags; #define DEFAULT_SIGNED_CHAR 1 -/* #define DEFAULT_SHORT_ENUMS 1 - This was the default for the IP2k but gcc has a bug (as of 17th May - 2001) in the way that library calls to the memory checker functions - are issues that screws things up if an enum is not equivalent to - an int. */ - #define SIZE_TYPE "unsigned int" #define PTRDIFF_TYPE "int" diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 395eec808933..e618c8eff81b 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1605,14 +1605,14 @@ always override this default with the options @option{-fsigned-char} and @option{-funsigned-char}. @end defmac -@defmac DEFAULT_SHORT_ENUMS -A C expression to determine whether to give an @code{enum} type -only as many bytes as it takes to represent the range of possible values -of that type. A nonzero value means to do that; a zero value means all +@deftypefn {Target Hook} bool TARGET_DEFAULT_SHORT_ENUMS (void) +This target hook should return true if the compiler should give an +@code{enum} type only as many bytes as it takes to represent the range +of possible values of that type. It should return false if all @code{enum} types should be allocated like @code{int}. -If you don't define the macro, the default is 0. -@end defmac +The default is to return false. +@end deftypefn @defmac SIZE_TYPE A C expression for a string describing the name of the data type to use diff --git a/gcc/opts.c b/gcc/opts.c index 45acba3c4f76..a83357b72dda 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "diagnostic.h" #include "tm_p.h" /* For OPTIMIZATION_OPTIONS. */ #include "insn-attr.h" /* For INSN_SCHEDULING. */ +#include "target.h" /* Value of the -G xx switch, and whether it was passed or not. */ unsigned HOST_WIDE_INT g_switch_value; @@ -594,10 +595,8 @@ decode_options (unsigned int argc, const char **argv) /* Initialize whether `char' is signed. */ flag_signed_char = DEFAULT_SIGNED_CHAR; -#ifdef DEFAULT_SHORT_ENUMS /* Initialize how much space enums occupy, by default. */ - flag_short_enums = DEFAULT_SHORT_ENUMS; -#endif + flag_short_enums = targetm.default_short_enums (); /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can modify it. */ diff --git a/gcc/system.h b/gcc/system.h index 31a1b92357f4..2631de178df9 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -605,7 +605,8 @@ typedef char _Bool; ASM_OUTPUT_SECTION_NAME PROMOTE_FUNCTION_ARGS \ STRUCT_VALUE_INCOMING STRICT_ARGUMENT_NAMING \ PROMOTE_FUNCTION_RETURN PROMOTE_PROTOTYPES STRUCT_VALUE_REGNUM \ - SETUP_INCOMING_VARARGS EXPAND_BUILTIN_SAVEREGS + SETUP_INCOMING_VARARGS EXPAND_BUILTIN_SAVEREGS \ + DEFAULT_SHORT_ENUMS /* Other obsolete target macros, or macros that used to be in target headers and were not used, and may be obsolete or may never have diff --git a/gcc/target-def.h b/gcc/target-def.h index 289ab412c6ee..ef4c777378c6 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -325,6 +325,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TARGET_GET_PCH_VALIDITY default_get_pch_validity #define TARGET_PCH_VALID_P default_pch_valid_p +#define TARGET_DEFAULT_SHORT_ENUMS hook_bool_void_false + #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_false #define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_false #define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false @@ -390,6 +392,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TARGET_BUILD_BUILTIN_VA_LIST, \ TARGET_GET_PCH_VALIDITY, \ TARGET_PCH_VALID_P, \ + TARGET_DEFAULT_SHORT_ENUMS, \ TARGET_HAVE_NAMED_SECTIONS, \ TARGET_HAVE_CTORS_DTORS, \ TARGET_HAVE_TLS, \ diff --git a/gcc/target.h b/gcc/target.h index aa56d64f5720..ed96b02efe4d 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -410,6 +410,11 @@ struct gcc_target void * (* get_pch_validity) (size_t *); const char * (* pch_valid_p) (const void *, size_t); + /* True if the compiler should give an @code{enum} type only as many + bytes as it takes to represent the range of possible values of + that type. */ + bool (* default_short_enums) (void); + /* Leave the boolean fields at the end. */ /* True if arbitrary sections are supported. */