aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2000-07-12 20:15:20 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2000-07-12 20:15:20 +0000
commit895ea61453c945cced3974a35173dd58c7753758 (patch)
treee7fca6dc3d8c848108c755daa00e7fe40a2c41e3 /gcc
parent8364301f5a1725e900f4554f5d9358146c804ee3 (diff)
downloadgcc-895ea61453c945cced3974a35173dd58c7753758.zip
gcc-895ea61453c945cced3974a35173dd58c7753758.tar.gz
gcc-895ea61453c945cced3974a35173dd58c7753758.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/c-decl.c4
-rw-r--r--gcc/c-parse.in7
-rw-r--r--gcc/c-typeck.c4
-rw-r--r--gcc/invoke.texi10
5 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2f44e35..079c764 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 619c20c..f212e18 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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));
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 04e160d..87dfceb 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -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
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index bebe4a9..f029764 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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. */
diff --git a/gcc/invoke.texi b/gcc/invoke.texi
index e1f2503..95d7435 100644
--- a/gcc/invoke.texi
+++ b/gcc/invoke.texi
@@ -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