]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: (gcc) ignore -Wunused-but-set-variable for bison
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Tue, 6 Jan 2026 15:43:45 +0000 (10:43 -0500)
committerKarel Zak <kzak@redhat.com>
Wed, 7 Jan 2026 09:46:25 +0000 (10:46 +0100)
[kzak@redhat.com: - merge two Christian's patches to make it more portable]

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/filter-parser.y
sys-utils/hwclock-parse-date.y

index a7d41408ef470b77d387e352b8fe541828b89f7e..23b05df33a997101af4ef9406d8b06b6b02c59ab 100644 (file)
@@ -1,9 +1,12 @@
 %{
-#ifdef __clang__
-/* clang detects yynerrs as unused.
- * Will be fixed in future versions of bison.
+/*
+ * Compilers detect yynerrs as unused. Let's hope it will be fixed in future
+ * versions of Bison.
  */
-#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+#if defined(__GNUC__) && !defined(__clang__)
+# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#elif defined(__clang__)
+# pragma clang diagnostic ignored "-Wunused-but-set-variable"
 #endif
 
 #include <stdio.h>
index 5d6daf0e65d9896ddbdb8241bd9323f95c8a1390..dd379cab74e9d046e16c7504ad691f4dfa137893 100644 (file)
  * TZ strings in dates.
  */
 
-#ifdef __clang__
-/* clang 15 detects yynerrs as unused.
- * Will be fixed in future versions of bison.
+/*
+ * Compilers detect yynerrs as unused. Let's hope it will be fixed in future
+ * versions of Bison.
  */
-#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+#if defined(__GNUC__) && !defined(__clang__)
+# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#elif defined(__clang__)
+# pragma clang diagnostic ignored "-Wunused-but-set-variable"
 #endif
 
 /**