This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch to warn about static initializers for zero length arrays

  In message <>you write:
  > This is a multi-part message in MIME format.
  > --------------0A117EABE3D36319A1D83F10
  > Content-Type: text/plain; charset=us-ascii
  > Content-Transfer-Encoding: 7bit
  > The following patch makes gcc print warnings for initializers of
  > zero length arrays as excess initializers.  This moves gcc toward
  > conforming with the C99 standard on flexible arrays (
  > 	* 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
Thanks.  Please install this patch.

  > I have also attached a file, zerolength.c, which demonstrates gcc
  > warning about the initializer.  Assuming that the patch is installed
  > the following messages should be generated:
If you could add this to the gcc.dg testing framework it would be
greatly appreciated.  You should be able to find examples of how to test
for error messages by looking at other tests in that framework.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]