* 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
+2004-02-23 Kazu Hirata <kazu@cs.umass.edu>
+
+ * 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 <ebotcazou@libertysurf.fr>
Falk Hueffner <falk@debian.org>
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
/* 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
#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"
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
#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;
/* 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. */
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
#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
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, \
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. */