OSDN Git Service

gcc/:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Apr 2009 15:51:26 +0000 (15:51 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Apr 2009 15:51:26 +0000 (15:51 +0000)
commit841fdaa6384db60565fd3563c75fd45579dc2656
tree1f0d9f50c4eb35dde54f0cbacee826d856fe8113
parentd94bf438e1849e977bccbd68754873d6b6c1057a
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
gcc/ChangeLog
gcc/c-opts.c
gcc/c-parser.c
gcc/c-tree.h
gcc/c-typeck.c
gcc/c.opt
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wenum-compare-1.c [new file with mode: 0644]