[cfe-commits] r154643 - in /cfe/trunk: lib/Lex/Lexer.cpp test/Lexer/newline-eof-c++11.cpp test/Lexer/newline-eof.c

Seth Cantrell seth.cantrell at gmail.com
Thu Apr 12 19:32:34 PDT 2012


What exactly should be behavior be for this?

If -Wc++98-compat-pedantic, C++11, and -Wnewline-eof/-pedantic are all enabled then obviously we want the C++98 compat pedantic warning.

But what if

-Wc++98-compat-pedantic is enabled, but neither C++11 nor -Wnewline-eof/-pedantic is enabled?

-Wc++98-compat-pedantic is enabled, C++11 is enabled, but -Wnewline-eof/-pedantic is not?

-Wc++98-compat-pedantic is enabled, C++11 is not enabled, -Wnewline-eof/-pedantic is enabled?


If only C++11 and -Wc++98-compat-pedantic are enabled I'd expect to get warnings out if and only if the same source would output warnings without C++11 enabled, given other options remaining the same. However with my current implementation this case emits a warning even when C++98 mode would not. This is because the C++98 compat warning I've implemented is InGroup<CXX98CompatPedantic> and has no relation to InGroup<DiagGroup<"newline-eof">>. So, should -Wc++98-compat-pedantic be made to imply -pedantic, or is it okay for the first case to be silent while the second case emits a warning?

The third case should obviously output a warning, and I'm not sure it matters all that much whether it's the C++98 compat warning or the normal newline-eof warning. Currently I'm outputting the normal warning, which seems like the right thing.

I've attached my current set of changes.

- Seth


On Apr 12, 2012, at 9:09 PM, Seth Cantrell wrote:

> Sure, I can do that.
> 
> On Apr 12, 2012, at 9:05 PM, Richard Smith wrote:
> 
>> On Thu, Apr 12, 2012 at 6:00 PM, Seth Cantrell <seth.cantrell at gmail.com> wrote:
>> Author: socantre
>> Date: Thu Apr 12 20:00:34 2012
>> New Revision: 154643
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=154643&view=rev
>> Log:
>> C++11 no longer requires files to end with a newline
>> 
>> Do you fancy adding a -Wc++98-compat-pedantic warning for this? If not, let me know and I'll do it.
>> 
>> Thanks!
>> Richard
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120412/a91ea068/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c++98-compat-pedantic-newline-eof.diff
Type: application/octet-stream
Size: 2097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120412/a91ea068/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120412/a91ea068/attachment-0001.html>


More information about the cfe-commits mailing list