Skip to content

Warning escalated to error during aarch64 compilation #23

@samek-h

Description

@samek-h

When compiling (natively) on aarch64, -Wunused-const-variable gets promoted to error (due to -Werror):

$ make
gcc -Wall -Werror -D_GNU_SOURCE -DVER_MAJOR=1 -DVER_MINOR=6   -static -O0 -ggdb   -c -o cmos_rw.o cmos_rw.c
gcc -Wall -Werror -D_GNU_SOURCE -DVER_MAJOR=1 -DVER_MINOR=6   -static -O0 -ggdb   -c -o commands.o commands.c
gcc -Wall -Werror -D_GNU_SOURCE -DVER_MAJOR=1 -DVER_MINOR=6   -static -O0 -ggdb   -c -o io_rw.o io_rw.c
gcc -Wall -Werror -D_GNU_SOURCE -DVER_MAJOR=1 -DVER_MINOR=6   -static -O0 -ggdb   -c -o logic.o logic.c
gcc -Wall -Werror -D_GNU_SOURCE -DVER_MAJOR=1 -DVER_MINOR=6   -static -O0 -ggdb   -c -o misc.o misc.c
In file included from misc.c:33:                                                                                                                                                      
misc.c:261:29: error: ‘cpuid_params’ defined but not used [-Werror=unused-const-variable=]                                                                                            
  261 | MAKE_PREREQ_PARAMS_VAR_ARGS(cpuid_params, 3, 4, "<cpu> <function> [index]", 0);                                                                                               
      |                             ^~~~~~~~~~~~                                                                                                                                      
commands.h:77:36: note: in definition of macro ‘MAKE_PREREQ_PARAMS_VAR_ARGS’                                                                                                          
   77 |  static const struct prereq_params name_ = \                                                                                                                                  
      |                                    ^~~~~                                                                                                                                      
cc1: all warnings being treated as errors
make: *** [<builtin>: misc.o] Error 1

Can be supressed by appending -Wno-error=unused-const-variable to CFLAGS.
EDIT: can be fixed by making the creation of variadic parameters structure for command cpuid conditionally compiled in only for x86 - see #24 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions