summaryrefslogtreecommitdiffstats
path: root/gcc/c-tree.h
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-15 15:51:26 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-15 15:51:26 +0000
commit841fdaa6384db60565fd3563c75fd45579dc2656 (patch)
tree1f0d9f50c4eb35dde54f0cbacee826d856fe8113 /gcc/c-tree.h
parentd94bf438e1849e977bccbd68754873d6b6c1057a (diff)
downloadppe42-gcc-841fdaa6384db60565fd3563c75fd45579dc2656.tar.gz
ppe42-gcc-841fdaa6384db60565fd3563c75fd45579dc2656.zip
gcc/:
* c.opt (Wenum-compare): Enable for C and Objc. Initialize to -1. * c-opts.c (c_common_handle_option): For C, set warn_enum_compare for -Wall and for -Wc++-compat. (c_common_post_options): For C++, set warn_enum_compare if not already set. * c-tree.h (struct c_expr): Add field original_type. (build_external_ref): Update declaration. * c-parser.c (c_parser_braced_init): Set original_type. (c_parser_initelt): Likewise. (c_parser_expr_no_commas): Likewise. (c_parser_conditional_expression): Likewise. (c_parser_cast_expression): Likewise. (c_parser_unary_expression): Likewise. Pull setting of original_code to top of function. (c_parser_sizeof_expression): Set original_type. (c_parser_alignof_expression): Likewise. (c_parser_postfix_expression): Likewise. Pull setting of original_code to top of function. (c_parser_postfix_expression_after_paren_type): Set original_type. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_expression): Likewise. * c-typeck.c (build_external_ref): Add type parameter. Change all callers. (c_expr_sizeof_expr): Set original_type field. (parser_build_unary_op): Likewise. (parser_build_binary_op): Likewise. Optionally warn about comparisons of enums of different types. (digest_init): Set original_type field. (really_start_incremental_init): Likewise. (push_init_level, pop_init_level): Likewise. * doc/invoke.texi (Warning Options): -Wenum-compare now supported in C. gcc/testsuite/: * gcc.dg/Wenum-compare-1.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146127 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-tree.h')
-rw-r--r--gcc/c-tree.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index ac9586b8243..6b9fcc798ca 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -163,6 +163,11 @@ struct c_expr
initializers, or ERROR_MARK for other expressions (including
parenthesized expressions). */
enum tree_code original_code;
+ /* If not NULL, the original type of an expression. This will
+ differ from the type of the value field for an enum constant.
+ The type of an enum constant is a plain integer type, but this
+ field will be the enum type. */
+ tree original_type;
};
/* A kind of type specifier. Note that this information is currently
@@ -577,7 +582,7 @@ extern struct c_expr default_function_array_conversion (struct c_expr);
extern tree composite_type (tree, tree);
extern tree build_component_ref (tree, tree);
extern tree build_array_ref (tree, tree, location_t);
-extern tree build_external_ref (tree, int, location_t);
+extern tree build_external_ref (tree, int, location_t, tree *);
extern void pop_maybe_used (bool);
extern struct c_expr c_expr_sizeof_expr (struct c_expr);
extern struct c_expr c_expr_sizeof_type (struct c_type_name *);
OpenPOWER on IntegriCloud