New macro expander preamble

Zack Weinberg zackw@Stanford.EDU
Mon Oct 30 20:32:00 GMT 2000


On Fri, Oct 27, 2000 at 07:41:18PM +0100, Neil Booth wrote:
> Zack Weinberg wrote:-
> 
> > This sort of thing should get a trigraph warning:
> > 
> > /* blah *??/
> > /
> 
> The comment is done properly with -trigraphs; I forgot the switch.

Yep.

> I thought we agreed we don't warn about trigraphs in comments?

As long as they don't affect the meaning of the program.  This one
does.  The other cases we care about are /??/N*, /??/N/, and ??/N at
the end of a line comment.  (Where N is a newline.)  The first two get
caught already.

BTW, there's an interesting bug:

$ ./cpp0 -Wall - /dev/null
abcdef??<
^D
<stdin>:1:2: warning: trigraph ??< ignored
<stdin>:1:2: warning: trigraph ??< ignored

Seems to happen for any trigraph except when it occurs at the very
beginning of a line.  dg.exp won't catch this, by the way.

> If you consider this to be outside a comment, it's going to be
> painful to catch this one special case.

This is sufficiently perverse that we can get away with it not being
warned about, because no one will actually do it.  But we should at
least put a comment in the trigraph warner pointing out this
particular case and why it isn't caught.

zw


More information about the Gcc-patches mailing list