mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-19 02:00:54 +08:00
c-decl.c (define_label): Warn about identifier conflicts with labels in traditional C.
* c-decl.c (define_label): Warn about identifier conflicts with labels in traditional C. * c-parse.in (unop +): Warn about the unary plus operator for traditional C. * c-typeck.c (store_init_value): Warn about automatic aggregate initialization for traditional C. * invoke.texi (-Wtraditional): Document new warnings. From-SVN: r34997
This commit is contained in:
parent
8364301f5a
commit
895ea61453
@ -1,3 +1,16 @@
|
||||
2000-07-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* c-decl.c (define_label): Warn about identifier conflicts with
|
||||
labels in traditional C.
|
||||
|
||||
* c-parse.in (unop +): Warn about the unary plus operator for
|
||||
traditional C.
|
||||
|
||||
* c-typeck.c (store_init_value): Warn about automatic aggregate
|
||||
initialization for traditional C.
|
||||
|
||||
* invoke.texi (-Wtraditional): Document new warnings.
|
||||
|
||||
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
|
||||
|
||||
* Makefile.in (c-errors.o): Fix thinko in dependency.
|
||||
|
@ -2706,6 +2706,10 @@ define_label (filename, line, name)
|
||||
decl = lookup_label (name);
|
||||
}
|
||||
|
||||
if (warn_traditional && lookup_name (name))
|
||||
warning ("traditional C lacks a separate namespace for labels, identifier `%s' conflicts",
|
||||
IDENTIFIER_POINTER (name));
|
||||
|
||||
if (DECL_INITIAL (decl) != 0)
|
||||
{
|
||||
error ("duplicate label `%s'", IDENTIFIER_POINTER (name));
|
||||
|
@ -411,7 +411,12 @@ unop: '&'
|
||||
| '-'
|
||||
{ $$ = NEGATE_EXPR; }
|
||||
| '+'
|
||||
{ $$ = CONVERT_EXPR; }
|
||||
{ $$ = CONVERT_EXPR;
|
||||
ifc
|
||||
if (warn_traditional)
|
||||
warning ("traditional C rejects the unary plus operator");
|
||||
end ifc
|
||||
}
|
||||
| PLUSPLUS
|
||||
{ $$ = PREINCREMENT_EXPR; }
|
||||
| MINUSMINUS
|
||||
|
@ -4401,6 +4401,10 @@ store_init_value (decl, init)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (warn_traditional
|
||||
&& AGGREGATE_TYPE_P (TREE_TYPE (decl)) && ! TREE_STATIC (decl))
|
||||
warning ("traditional C rejects automatic aggregate initialization");
|
||||
|
||||
DECL_INITIAL (decl) = value;
|
||||
|
||||
/* ANSI wants warnings about out-of-range constant initializers. */
|
||||
|
@ -1824,6 +1824,16 @@ Usage of ANSI string concatenation is detected.
|
||||
|
||||
@item
|
||||
A function macro appears without arguments.
|
||||
|
||||
@item
|
||||
The unary plus operator.
|
||||
|
||||
@item
|
||||
Initialization of automatic aggregates.
|
||||
|
||||
@item
|
||||
Identifier conflicts with labels. Traditional C lacks a separate
|
||||
namespace for labels.
|
||||
@end itemize
|
||||
|
||||
@item -Wundef
|
||||
|
Loading…
x
Reference in New Issue
Block a user