[cfe-dev] C++11 newline eof

David Blaikie dblaikie at gmail.com
Thu Apr 12 15:47:49 PDT 2012


On Thu, Apr 12, 2012 at 3:40 PM, Seth Cantrell <seth.cantrell at gmail.com> wrote:
> Please review this patch:
>
>> diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
>> index e5d26ff..f27e238 100644
>> --- a/lib/Lex/Lexer.cpp
>> +++ b/lib/Lex/Lexer.cpp
>> @@ -2382,7 +2382,8 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) {
>>
>>    // C99 5.1.1.2p2: If the file is non-empty and didn't end in a newline, issue
>>    // a pedwarn.
>> -  if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r'))
>> +  if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')
>> +      && !LangOpts.CPlusPlus0x) // C++11 [lex.phases] 2.2 p2
>>      Diag(BufferEnd, diag::ext_no_newline_eof)
>>        << FixItHint::CreateInsertion(getSourceLocation(BufferEnd), "\n");
>>
>>
>>
>
>
> Also, can anyone tell me why when I run clang with -verify and -std=c++11 I get a warning "clang: warning: argument unused during compilation: '-verify'"? I've verified that my patch changes the warnings output from clang based on the -std=c++11 flag, but since -verify doesn't seen work I can't add a working test. Here's a test that should fail but doesn't for me:

-verify is a cc1 (the underlying clang binary, not the gcc-compatible
driver) option - use %clang_cc1 instead of %clang & you should be fine

>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list