This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Warning from cpp on macro argument stringification is missing
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Warning from cpp on macro argument stringification is missing
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Thu, 7 Sep 2000 08:50:08 -0700
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <200009071540.LAA10067@caip.rutgers.edu>
On Thu, Sep 07, 2000 at 11:40:09AM -0400, Kaveh R. Ghazi wrote:
> > From: Zack Weinberg <zack@wolery.cumb.org>
> >
> > On Wed, Sep 06, 2000 at 11:29:01AM -0400, Kaveh R. Ghazi wrote:
> > > Zack,
> > >
> > > There used to be a -Wtraditional warning from cpp on stringification
> > > of macro arguments. It seems to have disappeared.
> >
> > Right. It got lost in the shuffle during the macro expander rewrite.
> > I've been meaning to fix it for some time, but the way things are
> > right now I doubt I'll get to it in the next few months!
> >
> > But if you would like to patch it back in, I'd be happy to review.
> > zw
>
> After the rewrite, the code no longer resembles anything like what it
> was. So I don't know where to plug in the warning. It used to occur
> in collect_expansion in cpphash.c (in 2.95), but this function no
> longer exists in cpplib AFAICT. It seems to mave been replaced by
> save_expansion, but that's not quite the same.
I believe save_expansion is the right place to put the warning.
There's a loop that scans over all the tokens in the replacement list
looking for argument names. You just need to add cases for
string-constant nodes (CPP_STRING, CPP_CHAR); I don't think we should
warn about this in wide string/char constants because such code is
obviously not meant to compile with traditional C anyway.
zw