Messages in this thread | | | From | Geert Uytterhoeven <> | Date | Mon, 11 Sep 2023 15:41:44 +0200 | Subject | Re: [PATCH 15/52] m68k: emu: Mark version[] __maybe_unused |
| |
Hi Arnd,
On Sat, Sep 9, 2023 at 4:07 PM Arnd Bergmann <arnd@arndb.de> wrote: > On Sat, Sep 9, 2023, at 14:12, Geert Uytterhoeven wrote: > > On Sat, Sep 9, 2023 at 10:28 AM Arnd Bergmann <arnd@arndb.de> wrote: > >> On Thu, Sep 7, 2023, at 15:41, Geert Uytterhoeven wrote: > >> > When building with W=1: > >> > > >> > m68k/arch/m68k/emu/nfeth.c:42:19: warning: ‘version’ defined but > >> > not used [-Wunused-const-variable=] > >> > 42 | static const char version[] = > >> > | ^~~~~~~ > >> > > >> > Fix this while obeying the wishes of the original copyright holders by > >> > marking version[] with __maybe_unused. > >> > > >> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> > >> > >> That will just drop it from the object file, maybe it should > >> instead be marked "__used" ? > > > > Given it's been like this since the beginning, I guess it never showed > > up in the object file anyway... > > Older compilers used to keep unused variables, and all versions > still do when building with -O0 instead of the usual -O2. > > I can see on godbolt.org that gcc-1.27 did not have that optimization > yet, while gcc-4.1 had it, but I haven't found any versions between > those. I vaguely remember us throwing out the version strings from > most kernel files a long time ago, possibly that was triggered by > gcc no longer putting them into the object any more, but I can't > find a reference for that. > > What I can see is that a lot of old network drivers have version > strings like this one, but they are actually printed from the > probe function, and lost their __devinitdata annotation in the past.
The version string in arch/m68k/emu/nfeth.c used to be __devinitdata, too, but it was never printed. So I'm just gonna silence the warning, as this patch does.
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
| |