Seongbae Park - [PATCH]: Add a new option -Wvariable-length-array (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]
Other format: [Raw text]

Hi,

Currently -pedantic warns about any usage of variable-length array in non-C99 mode and in C++. However, -pendantic brings whole swath of warnings that it's not desirable in some circumstances. This patch adds a new flag -Wvariable-length-array which issues a warning for any variable-length array usage regardless of C99 or pedantic. The main intention is to support checking of coding styles that don't allow variable-length arrays. The patch is tested on i686-linux. Ok for mainline ?

ChangeLog 2007-02-06 Seongbae Park seongbae.park@gmail.com

* gcc/doc/invoke.texi (Wvariable-length-arra): New warning.

gcc/ChangeLog 2007-02-06 Seongbae Park seongbae.park@gmail.com * c-decl.c (grokdeclarator): Support new flag warn_vla. Use "variable length array" instead of "variable-sized array". * c.opt (Wvariable-length-array): New flag.

gcc/testsuite/ChangeLog 2007-02-06 Seongbae Park seongbae.park@gmail.com

  * gcc.dg/wvariable-length-array-1.c: New test
  * g++.dg/warn/Wvariable-length-array-1.C: New test

gcc/cp/ChangeLog 2007-02-06 Seongbae Park seongbae.park@gmail.com

* decl.c (compute_array_index_type): New warning flag warn_vla.

-- #pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com";

Attachment:wvla.diff.txt
Description: Text document


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