diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-03-27 23:00:45 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-03-27 23:00:45 +0100 |
commit | 7810f87a4717af9eb77a1985077ec25c5951e52b (patch) | |
tree | 241c69a708f0e3af687769856a33ce9c0c654b89 /gcc | |
parent | a9e4a1a56fb8e99594b65d6640432ba29c705f3e (diff) | |
download | gcc-7810f87a4717af9eb77a1985077ec25c5951e52b.zip gcc-7810f87a4717af9eb77a1985077ec25c5951e52b.tar.gz gcc-7810f87a4717af9eb77a1985077ec25c5951e52b.tar.bz2 |
Restructure -Wno-narrowing documentation
* doc/invoke.texi (-Wno-narrowing): Reorder so default behavior is
covered first.
From-SVN: r246513
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 19 |
2 files changed, 14 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a272917..a45168e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-27 Jonathan Wakely <jwakely@redhat.com> + + * doc/invoke.texi (-Wno-narrowing): Reorder so default behavior is + covered first. + 2017-03-27 Jakub Jelinek <jakub@redhat.com> PR target/80102 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3f0eb2f..8d3821e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2869,10 +2869,17 @@ During the link-time optimization warn about type mismatches in global declarations from different compilation units. Requires @option{-flto} to be enabled. Enabled by default. -@item -Wnarrowing @r{(C++ and Objective-C++ only)} +@item -Wno-narrowing @r{(C++ and Objective-C++ only)} @opindex Wnarrowing @opindex Wno-narrowing -With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing +For C++11 and later standards, narrowing conversions are diagnosed by default, +as required by the standard. A narrowing conversion from a constant produces +an error, and a narrowing conversion from a non-constant produces a warning, +but @option{-Wno-narrowing} suppresses the diagnostic. +Note that this does not affect the meaning of well-formed code; +narrowing conversions are still considered ill-formed in SFINAE contexts. + +With @option{-Wnarrowing} in C++98, warn when a narrowing conversion prohibited by C++11 occurs within @samp{@{ @}}, e.g. @@ -2882,14 +2889,6 @@ int i = @{ 2.2 @}; // error: narrowing from double to int This flag is included in @option{-Wall} and @option{-Wc++11-compat}. -When a later standard is in effect, e.g. when using @option{-std=c++11}, -narrowing conversions are diagnosed by default, as required by the standard. -A narrowing conversion from a constant produces an error, -and a narrowing conversion from a non-constant produces a warning, -but @option{-Wno-narrowing} suppresses the diagnostic. -Note that this does not affect the meaning of well-formed code; -narrowing conversions are still considered ill-formed in SFINAE contexts. - @item -Wnoexcept @r{(C++ and Objective-C++ only)} @opindex Wnoexcept @opindex Wno-noexcept |