aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-02-23 14:10:58 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-02-23 14:10:58 +0000
commit221ee7c920c3eb45da77f01f82c4611798473fcf (patch)
tree684973460c4b2cce9b47cff5b069f2fbfe37d61d /gcc
parent9bdfe70405125e57b5ef92bba66eb268c43ab1d4 (diff)
downloadgcc-221ee7c920c3eb45da77f01f82c4611798473fcf.zip
gcc-221ee7c920c3eb45da77f01f82c4611798473fcf.tar.gz
gcc-221ee7c920c3eb45da77f01f82c4611798473fcf.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/config/cris/cris.h2
-rw-r--r--gcc/config/ip2k/ip2k.h6
-rw-r--r--gcc/doc/tm.texi12
-rw-r--r--gcc/opts.c5
-rw-r--r--gcc/system.h3
-rw-r--r--gcc/target-def.h3
-rw-r--r--gcc/target.h5
9 files changed, 34 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e73f7b2..17ee9e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+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>
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 0c1b23c..f394b5f 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 5110f9a..10147b2 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 6457e8b..4685d03 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 395eec8..e618c8e 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 45acba3..a83357b 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 31a1b92..2631de1 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 289ab41..ef4c777 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 aa56d64..ed96b02 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. */