diff mbox

[wwwdocs] New bits to porting_to

Message ID 20160210164657.GB3289@redhat.com
State New
Headers show

Commit Message

Marek Polacek Feb. 10, 2016, 4:46 p.m. UTC
Some minor issues I noticed.

Ok?


	Marek

Comments

Jonathan Wakely Feb. 10, 2016, 5:14 p.m. UTC | #1
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.

>+The <code>std::auto_ptr</code> template class was deprecated in C++11, so GCC

s/template class/class template/
diff mbox

Patch

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 &lt;stdlib.h&gt;
+
+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>