Red Hat Bugzilla – Bug 34337
gcc tries to interpret trigraphs in string constants
Last modified: 2007-03-26 23:43:05 EDT
Trying to compile this simple program:
--- 8< --- trigraph-error.c ---
int main (int argc, char **argv)
puts ("Error (???) FIXME");
--- >8 ------------------------
with "gcc -Wall" results in this warning:
trigraph-error.c:5:24: warning: trigraph ??) ignored
I don't think that it's correct for gcc to try to interpret trigraphs
inside string constants.
What's so special about trigraphs in string constants?
The warning you see is not about interpreting the trigraph, it is a
portability warning (the program will give different result when compiled
with -std=c89 (or -ansi or -std=c99) than without these options.
With e.g. C99 you get a different warning:
gcc -O2 -std=c99 -o o o.c -Wall
o.c:5:18: warning: trigraph ??) converted to ]
E.g. ISO C99 standard explicitely lists as an example that
does the same as
The only place where -Wtrigraphs does not warn in is in comments.