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]

Re: [PATCH]: New warning option -Walloca


On Fri, 31 Aug 2007, Raksit Ashok wrote:

> > > > Dave> Well, there's a thought: maybe poison should behave like warnings (i.e.
> > > > Dave> be suppressed for the most part) when it comes to system headers?
> > >
> > > This sounds like it would work too.
> > >
> >
> > Manuel> But then you won't get any warning when you use alloca through
> > Manuel> another function or through a macro redefinition. Is that what you
> > Manuel> really want?
>
> If we could poison alloca, and ignore alloca's in system headers (for
> example, by making "poison alloca" a warning, and using
> -Wno-system-headers), we would miss cases where alloca is used thru
> another function or macro in system headers.

A simpler approach would be to define alloca to something else *after* you
include system headers.  E.g.:

#define alloca dont_use_alloca

Then any time someone uses alloca they get spanked by the compiler and/or
linker.  This is stronger than poisoning because it affects the alloca
calls that appear through macro expansions.  You can do this in a common
header included across the whole project.  Each approach (poison vs macro)
has its uses.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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