Take two - CPP: #line semantic changes

Zack Weinberg zack@codesourcery.com
Thu Mar 14 10:14:00 GMT 2002


On Wed, Mar 06, 2002 at 07:51:07PM +0000, Neil Booth wrote:
> > This is an unreliable test - it might be converting the newline back
> > to "\n" for use in error messages.
> 
> OK, I withdraw my objection.  It is probably a good idea, then, to do
> quoting of filenames in diagnostics too, like EDG would seem to do.

That's a separate patch, but yeah, good idea.

> Any idea what other UNIX vendor compilers do?  Is there a reliable test
> for this?

I don't have access to much of a range of UNIX vendor compilers.  A
lot of them use the EDG front end, so that's a good indicator.

This should be a reliable test:

#include <string.h>
#line 3 "stri\ng"
const char *s = __FILE__;
int main(void)
{
  return !!strcmp(s, "stri\ng");
}

I'm going to go ahead and check in the patch, though.  It's trivial to
turn escape interpretation back off if it turns out to be a bad idea,
and the rest of the change is valuable.

zw



More information about the Gcc-patches mailing list