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

Richard Smith richard at metafoo.co.uk
Thu Apr 12 20:32:41 PDT 2012


On Thu, Apr 12, 2012 at 7:32 PM, Seth Cantrell <seth.cantrell at gmail.com>wrote:

> What exactly should be behavior be for this?
>

The intent is that, if "-std=c++11 -Wc++98-compat-pedantic -pedantic"
produces no warnings, then your code should also compile cleanly with
"-std=c++98 -pedantic". "-Wc++98-compat" and "-Wc++98-compat-pedantic" are
only intended to catch compatibility issues caused by differences between
the current language and C++98, so should be a no-op if you are in C++98
mode. Hence:


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

Yes.


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

No warning: turning -Wc++98-compat-pedantic on in C++98 mode should have no
effect.


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

Produce a warning here.


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

No -Wc++98-compat-pedantic warning, but a 'no newline at end of file'
warning instead.

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.
>

The -Wc++98-compat warnings (a subset of the -Wc++98-compat-pedantic
warnings) behave that way.


> 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?
>

I'd prefer to keep the 'your code would not be pedantically-correct C++98'
and 'your code is not pedantically-correct C++11' flags controlling
disjoint sets of warnings, even though I can't imagine any use cases where
you would want the first but not the second. The graph of which warning
groups contain which others is complex enough already (and -pedantic is
already a very special case).

I've attached my current set of changes.
>

LGTM :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120412/7dfe6416/attachment.html>


More information about the cfe-commits mailing list