public inbox for gcc-cvs-wwwdocs@sourceware.org
help / color / mirror / Atom feed
* gcc-wwwdocs branch master updated. 75712dd8e232984cc6eb7dc9aee1aeddfb54bbe7
@ 2020-01-15 18:51 wilco
  0 siblings, 0 replies; only message in thread
From: wilco @ 2020-01-15 18:51 UTC (permalink / raw)
  To: gcc-cvs-wwwdocs

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".

The branch, master has been updated
       via  75712dd8e232984cc6eb7dc9aee1aeddfb54bbe7 (commit)
      from  2c7ec979b25dcea145daa4c490c12925ea9d2487 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 75712dd8e232984cc6eb7dc9aee1aeddfb54bbe7
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Fri Nov 29 12:48:15 2019 +0000

    Document -fcommon default change

diff --git a/htdocs/gcc-10/changes.html b/htdocs/gcc-10/changes.html
index 8e72bd4..5c25195 100644
--- a/htdocs/gcc-10/changes.html
+++ b/htdocs/gcc-10/changes.html
@@ -140,6 +140,13 @@ a work-in-progress.</p>
     <li>In C2X mode, <code>-fno-fp-int-builtin-inexact</code> is
     enabled by default.</li>
   </ul></li>
+
+  <li>GCC now defaults to <code>-fno-common</code>.  As a result, global
+      variable accesses are more efficient on various targets.  In C, global
+      variables with multiple tentative definitions now result in linker errors.
+      With <code>-fcommon</code> such definitions are silently merged during
+      linking.
+  </li>
 </ul>
 
 <h3 id="cxx">C++</h3>
diff --git a/htdocs/gcc-10/porting_to.html b/htdocs/gcc-10/porting_to.html
index 3256e8a..7d45a96 100644
--- a/htdocs/gcc-10/porting_to.html
+++ b/htdocs/gcc-10/porting_to.html
@@ -29,9 +29,25 @@ and provide solutions. Let us know if you have suggestions for improvements!
 <h2 id="cpp">Preprocessor issues</h2>
 -->
 
-<!--
 <h2 id="c">C language issues</h2>
--->
+
+<h3 id="common">Default to <code>-fno-common</code></h3>
+
+<p>
+  A common mistake in C is omitting <code>extern</code> when declaring a global
+  variable in a header file.  If the header is included by several files it
+  results in multiple definitions of the same variable.  In previous GCC
+  versions this error is ignored.  GCC 10 defaults to <code>-fno-common</code>,
+  which means a linker error will now be reported.
+  To fix this, use <code>extern</code> in header files when declaring global
+  variables, and ensure each global is defined in exactly one C file.
+  As a workaround, legacy C code can be compiled with <code>-fcommon</code>.
+</p>
+  <pre><code>
+      int x;  // tentative definition - avoid in header files
+
+      extern int y;  // correct declaration in a header file
+  </code></pre>
 
 <h2 id="fortran">Fortran language issues</h2>
 

-----------------------------------------------------------------------

Summary of changes:
 htdocs/gcc-10/changes.html    |  7 +++++++
 htdocs/gcc-10/porting_to.html | 20 ++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gcc-wwwdocs


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-15 18:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 18:51 gcc-wwwdocs branch master updated. 75712dd8e232984cc6eb7dc9aee1aeddfb54bbe7 wilco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).