From bcb8ea09d1c3f6d8f67a37a7b729eea6ba8ddab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Tue, 9 Nov 2021 13:59:40 +0100 Subject: [PATCH] lshwc: Fix compile error for gcc <8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With gcc < 8.1 the following compile error occurs: lshwc.c:52:37: error: initializer element is not constant static unsigned int read_interval = ioctlsleep, cfvn, csvn, authorization; ^~~~~~~~~~ Even though this gcc bug was fixed in gcc 8.1+, change the constant definition to a #define to make the tool compile with older compilers as well. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69960 Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66618 Signed-off-by: Jan Höppner --- cpumf/lshwc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpumf/lshwc.c b/cpumf/lshwc.c index 00caaec0..f9778170 100644 --- a/cpumf/lshwc.c +++ b/cpumf/lshwc.c @@ -46,9 +46,9 @@ #define CPUS_POSSIBLE "/sys/devices/system/cpu/possible" #define CPUS_KERNELMAX "/sys/devices/system/cpu/kernel_max" #define MAXCTRS 512 +#define IOCTLSLEEP 60U -static const unsigned int ioctlsleep = 60; -static unsigned int read_interval = ioctlsleep, cfvn, csvn, authorization; +static unsigned int read_interval = IOCTLSLEEP, cfvn, csvn, authorization; static unsigned long loop_count = 1; static unsigned char *ioctlbuffer; static bool allcpu;