From: Christian Goeschel Ndjomouo Date: Tue, 6 Jan 2026 15:43:45 +0000 (-0500) Subject: build-sys: (gcc) ignore -Wunused-but-set-variable for bison X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db9047892a45c06bceb5768e7bb8c887289b9859;p=thirdparty%2Futil-linux.git build-sys: (gcc) ignore -Wunused-but-set-variable for bison [kzak@redhat.com: - merge two Christian's patches to make it more portable] Signed-off-by: Christian Goeschel Ndjomouo Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/filter-parser.y b/libsmartcols/src/filter-parser.y index a7d41408e..23b05df33 100644 --- a/libsmartcols/src/filter-parser.y +++ b/libsmartcols/src/filter-parser.y @@ -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 diff --git a/sys-utils/hwclock-parse-date.y b/sys-utils/hwclock-parse-date.y index 5d6daf0e6..dd379cab7 100644 --- a/sys-utils/hwclock-parse-date.y +++ b/sys-utils/hwclock-parse-date.y @@ -34,11 +34,14 @@ * 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 /**