On Wed, Feb 10, 2016 at 05:14:40PM +0000, Jonathan Wakely wrote: > On 10/02/16 17:46 +0100, Marek Polacek wrote: > >+int > >+foo (unsigned x) > >+{ > >+ abs (x); > > Let's make this "return abs (x);" so we don't have a missing return. Ok.
> >+The <code>std::auto_ptr</code> template class was deprecated in C++11, so > >GCC > > s/template class/class template/ Fixed. I'll commit this then: Index: porting_to.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-6/porting_to.html,v retrieving revision 1.7 diff -u -r1.7 porting_to.html --- porting_to.html 9 Feb 2016 21:06:32 -0000 1.7 +++ porting_to.html 10 Feb 2016 17:17:49 -0000 @@ -220,6 +220,27 @@ the C++ standard library. </p> +<h4>Call of overloaded 'abs(unsigned int&)' is ambiguous</h4> + +<p> +The additional overloads can cause the compiler to reject invalid code that +was accepted before. An example of such code is the below: +</p> + +<pre><code> +#include <stdlib.h> +int +foo (unsigned x) +{ + return abs (x); +} +</code></pre> + +<p> +Since calling <code>abs()</code> on an unsigned value doesn't make sense, +this code will become explicitly invalid as per discussion in the LWG. +</p> + <h3>Optimizations remove null pointer checks for <code>this</code></h3> <p> @@ -239,6 +260,15 @@ pointers, not only those involving <code>this</code>. </p> +<h3>Deprecation of <code>std::auto_ptr</code></h3> + +<p> +The <code>std::auto_ptr</code> class template was deprecated in C++11, so GCC +now warns about its usage. This warning can be suppressed with the +<tt>-Wno-deprecated-declarations</tt> command-line option, though we advise +to port the code to use C++11's <code>std::unique_ptr</code> instead. +</p> + <h2>-Wmisleading-indentation</h2> <p> A new warning <code>-Wmisleading-indentation</code> was added @@ -303,8 +333,24 @@ the indentation of the source was fixed instead. </p> -<h3>Links</h3> +<h2>Enhanced <code>-Wnonnull</code></h2> +<p> +The <code>-Wnonnull</code> warning has been improved so that it also warns +about comparing parameters declared as nonnull with <code>NULL</code>. For +example, the compiler will warn about the following code: +</p> +<pre><code> +__attribute__((nonnull)) void +foo (void *p) +{ + if (p == NULL) + abort (); + // ... +} +</code></pre> + +<h3>Links</h3> </body> </html> Marek