From c530479e15d804667c83dfb738ce9cae035de9f2 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 7 Sep 1999 21:51:16 -0700 Subject: c-typeck.c (type_lists_compatible_p): Use simple_type_promotes_to. * c-typeck.c (type_lists_compatible_p): Use simple_type_promotes_to. (self_promoting_type_p): Delete. (self_promoting_args_p): Move ... * c-common.c: ... here. (c_common_nodes_and_builtins): Initialize lang_type_promotes_to. (simple_type_promotes_to): New. * builtins.c (lang_type_promotes_to): New. (expand_builtin_va_arg): Use it to give diagnostic for illegal types. * c-tree.h (C_PROMOTING_INTEGER_TYPE_P): Move ... * c-common.h: ... here. (self_promoting_args_p, simple_type_promotes_to): Declare. * c-decl.c (duplicate_decls): Use simple_type_promotes_to. (grokdeclarator): Likewise. * tree.h (lang_type_promotes_to): Declare. * cp-tree.h (C_PROMOTING_INTEGER_TYPE_P): Delete. * typeck.c (self_promoting_args_p): Delete. * gcc.dg/va-arg-1.c: New. From-SVN: r29180 --- gcc/c-common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gcc/c-common.h') diff --git a/gcc/c-common.h b/gcc/c-common.h index ab0cdec..7514092 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -192,3 +192,17 @@ extern void c_common_nodes_and_builtins PROTO((int, int, int)); extern tree build_va_arg PROTO((tree, tree)); extern tree initializer_constant_valid_p PROTO((tree, tree)); + +/* Nonzero if the type T promotes to itself. + ANSI C states explicitly the list of types that promote; + in particular, short promotes to int even if they have the same width. */ +#define C_PROMOTING_INTEGER_TYPE_P(t) \ + (TREE_CODE ((t)) == INTEGER_TYPE \ + && (TYPE_MAIN_VARIANT (t) == char_type_node \ + || TYPE_MAIN_VARIANT (t) == signed_char_type_node \ + || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \ + || TYPE_MAIN_VARIANT (t) == short_integer_type_node \ + || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node)) + +extern int self_promoting_args_p PROTO((tree)); +extern tree simple_type_promotes_to PROTO((tree)); -- cgit v1.1