Skip to content

Commit

Permalink
lshwc: Fix compile error for gcc <8.1
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
hoeppnerj committed Nov 10, 2021
1 parent 88619b6 commit bcb8ea0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpumf/lshwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bcb8ea0

Please sign in to comment.