[cfe-commits] r167359 - /cfe/trunk/unittests/Lex/PPCallbacksTest.cpp

Benjamin Kramer benny.kra at gmail.com
Sat Nov 3 14:18:16 PDT 2012


On 03.11.2012, at 22:10, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Sat, Nov 3, 2012 at 10:58 PM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Author: d0k
>> Date: Sat Nov  3 15:58:26 2012
>> New Revision: 167359
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=167359&view=rev
>> Log:
>> Escape trigraphs in unittest.
>> 
>> Modified:
>>    cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
>> 
>> Modified: cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/PPCallbacksTest.cpp?rev=167359&r1=167358&r2=167359&view=diff
>> ==============================================================================
>> --- cfe/trunk/unittests/Lex/PPCallbacksTest.cpp (original)
>> +++ cfe/trunk/unittests/Lex/PPCallbacksTest.cpp Sat Nov  3 15:58:26 2012
>> @@ -222,27 +222,25 @@
>>   ASSERT_EQ("<angled.h>", GetSourceString(Range));
>> }
>> 
>> -#pragma clang diagnostic ignored "-Wtrigraphs"
>> -
>> TEST_F(PPCallbacksTest, TrigraphFilename) {
>>   const char* Source =
>> -    "#include \"tri??-graph.h\"\n";
>> +    "#include \"tri\?\?-graph.h\"\n";
> 
> Hi Benjamin,
> 
> Is this correct?  IIRC, "\?" is not a correct escape sequence.  The
> correct way is to split the trigraph across multiple string literals
> and rely on concatenation: "?" "?-"

I don't see why \? shouldn't be valid. It's listed in C11 6.4.4.4p3 and C++11 [lex.ccon]. Haven't checked older revisions of the standards but it would surprise me if this changed recently.

- Ben



More information about the cfe-commits mailing list