Patched code to generate warning when trying to perform static
initialization of zero-length arrays. From-SVN: r36714
This commit is contained in:
parent
3a4fee6674
commit
4b606faf44
|
@ -1,3 +1,11 @@
|
|||
2000-10-04 Will Cohen <wcohen@redhat.com>
|
||||
|
||||
* c-typeck.c (process_init_element): Added warning for zero-length
|
||||
array.
|
||||
|
||||
* extend.texi (Zero Length): State that static initializers for
|
||||
zero-length arrays are not allowed.
|
||||
|
||||
Mon Oct 2 14:50:14 MET DST 2000 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* rtlanal.c (single_set_1): Do not require USE and CLOBBERs
|
||||
|
@ -1139,17 +1147,6 @@ Mon 18-Sep-2000 19:21:35 BST Neil Booth <NeilB@earthling.net>
|
|||
* config/sh/sh.md (sym_label2reg, symPLT_label2reg): Protect
|
||||
LABEL_REFs with a PIC-safe unspec.
|
||||
|
||||
2000-09-18 Will Cohen <wcohen@redhat.com>
|
||||
|
||||
* extend.texi (Zero Length): State that static initializers for
|
||||
zero-length arrays are not allowed.
|
||||
|
||||
* c-typeck.c (process_init_element): Flag initializers for zero
|
||||
length arrays.
|
||||
|
||||
* tree.c (integer_all_onesp): Ignore TREE_INT_CST_HIGH if prec is
|
||||
exactly HOST_BITS_PERWIDE_INT.
|
||||
|
||||
2000-09-18 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* c-common.c (check_format_info): Properly save the argument
|
||||
|
|
|
@ -6460,7 +6460,8 @@ process_init_element (value)
|
|||
}
|
||||
|
||||
if (constructor_max_index != 0
|
||||
&& tree_int_cst_lt (constructor_max_index, constructor_index))
|
||||
&& (tree_int_cst_lt (constructor_max_index, constructor_index)
|
||||
|| integer_all_onesp (constructor_max_index)))
|
||||
{
|
||||
pedwarn_init ("excess elements in array initializer");
|
||||
break;
|
||||
|
|
|
@ -889,6 +889,10 @@ struct line @{
|
|||
In standard C, you would have to give @code{contents} a length of 1, which
|
||||
means either you waste space or complicate the argument to @code{malloc}.
|
||||
|
||||
Static initialization of the zero-length array is not allowed. A
|
||||
warning will be generated for each initializer attempting to initialize
|
||||
the zero-length array.
|
||||
|
||||
@node Variable Length
|
||||
@section Arrays of Variable Length
|
||||
@cindex variable-length arrays
|
||||
|
|
Loading…
Reference in New Issue