c-typeck.c (process_init_element): For -Wtraditional, warn about initialization of unions.
* c-typeck.c (process_init_element): For -Wtraditional, warn about initialization of unions. * invoke.texi (-Wtraditional): Document new behavior. From-SVN: r35595
This commit is contained in:
parent
2bf9a2abfe
commit
253b6b828a
@ -1,3 +1,10 @@
|
|||||||
|
2000-08-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* c-typeck.c (process_init_element): For -Wtraditional, warn about
|
||||||
|
initialization of unions.
|
||||||
|
|
||||||
|
* invoke.texi (-Wtraditional): Document new behavior.
|
||||||
|
|
||||||
2000-08-09 Zack Weinberg <zack@wolery.cumb.org>
|
2000-08-09 Zack Weinberg <zack@wolery.cumb.org>
|
||||||
|
|
||||||
* configure.in (--enable-c-cpplib): Uncomment. Use AC_DEFINE
|
* configure.in (--enable-c-cpplib): Uncomment. Use AC_DEFINE
|
||||||
|
@ -6400,6 +6400,15 @@ process_init_element (value)
|
|||||||
fieldtype = TYPE_MAIN_VARIANT (fieldtype);
|
fieldtype = TYPE_MAIN_VARIANT (fieldtype);
|
||||||
fieldcode = TREE_CODE (fieldtype);
|
fieldcode = TREE_CODE (fieldtype);
|
||||||
|
|
||||||
|
/* Warn that traditional C rejects initialization of unions.
|
||||||
|
We skip the warning if the value is zero. This is done
|
||||||
|
under the assumption that the zero initializer in user
|
||||||
|
code appears conditioned on e.g. __STDC__ to avoid
|
||||||
|
"missing initializer" warnings and relies on default
|
||||||
|
initialization to zero in the traditional C case. */
|
||||||
|
if (warn_traditional && !integer_zerop (value))
|
||||||
|
warning ("traditional C rejects initialization of unions");
|
||||||
|
|
||||||
/* Accept a string constant to initialize a subarray. */
|
/* Accept a string constant to initialize a subarray. */
|
||||||
if (value != 0
|
if (value != 0
|
||||||
&& fieldcode == ARRAY_TYPE
|
&& fieldcode == ARRAY_TYPE
|
||||||
|
@ -1831,6 +1831,13 @@ Initialization of automatic aggregates.
|
|||||||
@item
|
@item
|
||||||
Identifier conflicts with labels. Traditional C lacks a separate
|
Identifier conflicts with labels. Traditional C lacks a separate
|
||||||
namespace for labels.
|
namespace for labels.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Initialization of unions. If the initializer is zero, the warning is
|
||||||
|
omitted. This is done under the assumption that the zero initializer in
|
||||||
|
user code appears conditioned on e.g. @code{__STDC__} to avoid missing
|
||||||
|
initializer warnings and relies on default initialization to zero in the
|
||||||
|
traditional C case.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@item -Wundef
|
@item -Wundef
|
||||||
|
Loading…
Reference in New Issue
Block a user