This is the mail archive of the gcc-bugs@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]

Re: Warning from cpp on macro argument stringification is missing


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

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