[wwwdocs] New bits to porting_to

Marek Polacek polacek@redhat.com
Wed Feb 10 16:47:00 GMT 2016


Some minor issues I noticed.

Ok?

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 16:45:37 -0000
@@ -220,6 +220,28 @@
 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)
+{
+  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 +261,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> template class 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 +334,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



More information about the Gcc-patches mailing list