I've got some (legacy) code that I'm building with clang for the first time. The code is something like:
sprintf(buf, "%s <%s ????>", p1, p2);
Clang gives the following warning (error with -Werror
):
test.c:6:33: error: trigraph converted to '}' character [-Werror,-Wtrigraphs]
sprintf(buf, "%s <%s ????>", p1, p2);
^
Clearly the ??>
is not intended as a trigraph, so I want to disable trigraphs entirely (the source does not intentionally use them anywhere).
I have tried -no-trigraphs
but that's not really an option:
clang: warning: argument unused during compilation: '-no-trigraphs'
I can turn off the trigraphs warning with -Wno-trigraphs
but I don't want the trigraph conversion to actually take place at all.
NOTE: Trigraphs were enabled as an unintended side effect of using -std=c89
.
Try using gnu* mode - "Trigraphs default to being off in gnu* modes; they can be enabled by the -trigraphs option." (see http://clang.llvm.org/docs/UsersManual.html#c_modes for other differences and command line switch)