sim: ppc: fix some Wunused-function warnings
authorTom de Vries <tdevries@suse.de>
Wed, 19 May 2021 15:46:24 +0000 (17:46 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 19 May 2021 15:46:24 +0000 (17:46 +0200)
commit8f09aa5ba86b4a57972c0b99d7063a3a0d0b2550
treeb6f735ff830eca6b866cad581fd5285b043a7198
parentee22a1a31d3432bb40b67229f75ae7c2a271e38e
sim: ppc: fix some Wunused-function warnings

When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into:
...
In file included from src/sim/ppc/cpu.h:251:0,
                 from src/sim/ppc/emul_generic.h:24,
                 from src/sim/ppc/emul_generic.c:24:
src/sim/ppc/cpu.c:76:1: error: 'cpu_create' defined but not used \
  [-Werror=unused-function]
 cpu_create(psim *system,
 ^~~~~~~~~~
...

The function is defined as:
...
INLINE_CPU\
(cpu *)
cpu_create(psim *system,
...
which expands to:
...
static cpu * __attribute__((__unused__))
cpu_create(psim *system,
...

The problem is that gcc does not associate the attribute to the function.
I've filed a PR about this ( PR gcc/100670 ), which may or may not be valid.

Work around/fix this by modifying the INLINE_* definitions in inline.h to move
UNUSED to the start such that we have:
...
__attribute__((__unused__)) static cpu *
cpu_create(psim *system,
...
sim/ppc/inline.h
This page took 0.02456 seconds and 4 git commands to generate.