From 2fa6ddddfe0ee1458171e85020a8cd97283a3d3f Mon Sep 17 00:00:00 2001 From: Richard Sandiford <richard@codesourcery.com> Date: Thu, 19 Jan 2006 16:28:31 +0000 Subject: [PATCH] * c-decl.c (add_flexible_array_elts_to_size): Simplify vector accesses. From-SVN: r109966 --- gcc/ChangeLog | 4 ++++ gcc/c-decl.c | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3eb84e7a71df..71eb7007f464 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2006-01-19 Richard Sandiford <richard@codesourcery.com> + + * c-decl.c (add_flexible_array_elts_to_size): Simplify vector accesses. + 2006-01-19 Jan Hubicka <jh@suse.cz> * tree-vect-patterns.c (vect_pattern_recog_1): Prevent parse error. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 8320acaf6514..d3bf14290c80 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3076,14 +3076,12 @@ set_array_declarator_inner (struct c_declarator *decl, static void add_flexible_array_elts_to_size (tree decl, tree init) { - unsigned int size; tree elt, type; - size = VEC_length (constructor_elt, CONSTRUCTOR_ELTS (init)); - if (size == 0) + if (VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (init))) return; - elt = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (init), size - 1)->value; + elt = VEC_last (constructor_elt, CONSTRUCTOR_ELTS (init))->value; type = TREE_TYPE (elt); if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == NULL_TREE -- GitLab