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 1d88109cc7d31372b1e18746aceaf204d095e163 (commit)
from 147ee6924dc23a4cb55fe74791ff20d9f4684635 (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 1d88109cc7d31372b1e18746aceaf204d095e163
Author: Jakub Jelinek <[email protected]>
Date: Tue Jan 20 11:31:31 2026 +0100
gcc-16: Fix up -Wunused-but-set-* changes description
diff --git a/htdocs/gcc-16/porting_to.html b/htdocs/gcc-16/porting_to.html
index 3bd1ff2b..74a5bf34 100644
--- a/htdocs/gcc-16/porting_to.html
+++ b/htdocs/gcc-16/porting_to.html
@@ -31,9 +31,49 @@ and provide solutions. Let us know if you have suggestions
for improvements!
<!-- introduced in 0eac9cfee8cb0b21de866a04d5d59685ab35208f -->
<p>
-Since GCC 16, <code>-Wunused-but-set-*</code> warning options no longer
-consider preincrements and postincrements as uses, which may lead to
-compilation failures when using <code>-Werror</code>.
+Since GCC 16, <code>-Wunused-but-set-*</code> warning options have been
+extended to have multiple levels controlling what kinds of uses disable
+the warnings for variables which are otherwise unused. Older versions of GCC
+only implemented what has become <code>-Wunused-but-set-variable=1</code>
+or <code>-Wunused-but-set-parameter=1</code>, while the new default
+for <code>-Wunused-but-set-variable</code> or
+<code>-Wunused-but-set-parameter</code> is <code>=3</code> (the new defaults
+are also used when these warnings are enabled by
+<code>-Wall</code> or <code>-Wextra</code>, respectively).
+<code>=2</code> ignores pre/post inc/decrements on the variable,
+<code>=3</code> also ignores compound assignments if the <em>LHS</em> variable
+is not also used on the <em>RHS</em>.
+<pre><code>
+void foo (void) {
+ int a = 1; // -Wunused-variable warning
+ int b = 0; // Warning for -Wunused-but-set-variable=<i>n</i> <i>n</i> >= 1
+ b = 1; b = 2;
+ int c = 0; // Warning for -Wunused-but-set-variable=<i>n</i> <i>n</i> >= 2
+ ++c; c--; --c; c++;
+ int d = 0; // Warning for -Wunused-but-set-variable=<i>n</i> <i>n</i> >= 3
+ d += 4;
+ int e = 0; // No warning, cast to void
+ (void) e;
+ int f = 0; // No warning, f used
+ int g = f = 5;
+ (void) g;
+ int h = 0; // No warning, preincrement used
+ int i = ++h;
+ (void) i;
+ int j = 0; // No warning, postdecrement used
+ int k = j--;
+ (void) k;
+ int l = 0; // No warning, l used
+ int m = l |= 2;
+ (void) m;
+}
+</code></pre>
+In order to avoid the warnings, one can either remove newly diagnosed
+variables or parameters which aren't used except in pre/post inc/decrements
+or compound assignments, make them used in some way, e.g. just
+casting to <code>(void)</code>, or lowering the level of the warning. See
+<a
href=https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-but-set-variable_003d"
+<code>-Wunused-but-set-*</code></a> documentation for more details.
</p>
</body>
-----------------------------------------------------------------------
Summary of changes:
htdocs/gcc-16/porting_to.html | 46 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
hooks/post-receive
--
gcc-wwwdocs