This is the mail archive of the gcc-patches@gcc.gnu.org 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] |
Other format: | [Raw text] |
Hi, This patch adds a "-Walloca" option to gcc. If this warning is enabled, gcc will emit a warning on encountering "alloca" calls. This option could be used to enforce coding conventions that forbid use of alloca. For example: http://www.dc.turkuamk.fi/docs/gnu/awk/gawk_21.html http://www-unix.mcs.anl.gov/mpi/mpich/adi3/mpich2/node316.htm Possible motivations for such a coding convention include: (1) Portability issues with alloca. (2) Enabling a stricter control over stack requirements; (no VLAs + no alloca's) => (bounded frame size), which is useful in the context of running thousands of threads with small stacks on 32-bit machines. Also small stacks in other contexts, such as embedded systems. I have tested the patch on i686-linux. OK for mainline? Thanks, Raksit ------ gcc/ChangeLog 2007-08-30 Raksit Ashok <raksit.ashok@gmail.com> * doc/invoke.texi (Option Summary): Mention -Walloca. (Warning Options): Document -Walloca. * c.opt (Walloca): New flag. * c-parser.c (c_parser_postfix_expression_after_primary): New warning based on flag warn_alloca. gcc/cp/ChangeLog 2007-08-30 Raksit Ashok <raksit.ashok@gmail.com> * parser.c (cp_parser_postfix_expression): New warning based on flag warn_alloca. gcc/testsuite/ChangeLog 2007-08-30 Raksit Ashok <raksit.ashok@gmail.com> * gcc.dg/walloca.c: New test. * g++.dg/warn/Walloca.C: New test.
Attachment:
walloca.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |