[U-Boot] [BUG] include/net.h: warning: 'eth_is_on_demand_init' defined but not used

Hello Joe,
compiling U-Boot creates dozens of warnings for include/net.h:
CC arch/arm/lib/asm-offsets.s In file included from include/common.h:342, from lib/asm-offsets.c:14: include/net.h:689:28: warning: always_inline function might not be inlinable [-Wattributes] 689 | static __always_inline int eth_is_on_demand_init(void) | ^~~~~~~~~~~~~~~~~~~~~ include/net.h:689:28: warning: 'eth_is_on_demand_init' defined but not used [-Wunused-function] HOSTCC scripts/dtc/srcpos.o In file included from include/common.h:342, from arch/arm/lib/asm-offsets.c:14: include/net.h:689:28: warning: always_inline function might not be inlinable [-Wattributes] 689 | static __always_inline int eth_is_on_demand_init(void) | ^~~~~~~~~~~~~~~~~~~~~ include/net.h:689:28: warning: 'eth_is_on_demand_init' defined but not used [-Wunused-function]
Software used for building U-Boot:
U-Boot HEAD, rpi_3_b_plus_defconfig gcc (FreeBSD Ports Collection) 9.1.0 FreeBSD generic 13.0-CURRENT FreeBSD 13.0-CURRENT r351591 GENERIC arm64
Why should we create this function in every file that by chance includes net.h?
The function is only used in drivers/net/netconsole.c and net/net.c.
One solution would be to create a dedicated include that is only referenced in these two files.
Best regards
Heinrich

Hi Heinrich,
On Fri, Aug 30, 2019 at 12:21 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Joe,
compiling U-Boot creates dozens of warnings for include/net.h:
CC arch/arm/lib/asm-offsets.s In file included from include/common.h:342, from lib/asm-offsets.c:14: include/net.h:689:28: warning: always_inline function might not be inlinable [-Wattributes] 689 | static __always_inline int eth_is_on_demand_init(void) | ^~~~~~~~~~~~~~~~~~~~~ include/net.h:689:28: warning: 'eth_is_on_demand_init' defined but not used [-Wunused-function] HOSTCC scripts/dtc/srcpos.o In file included from include/common.h:342, from arch/arm/lib/asm-offsets.c:14: include/net.h:689:28: warning: always_inline function might not be inlinable [-Wattributes] 689 | static __always_inline int eth_is_on_demand_init(void) | ^~~~~~~~~~~~~~~~~~~~~ include/net.h:689:28: warning: 'eth_is_on_demand_init' defined but not used [-Wunused-function]
Software used for building U-Boot:
U-Boot HEAD, rpi_3_b_plus_defconfig gcc (FreeBSD Ports Collection) 9.1.0 FreeBSD generic 13.0-CURRENT FreeBSD 13.0-CURRENT r351591 GENERIC arm64
Why should we create this function in every file that by chance includes net.h?
The function is only used in drivers/net/netconsole.c and net/net.c.
One solution would be to create a dedicated include that is only referenced in these two files.
We could, but it might also be reasonable to allow the compiler the prerogative to inline it or not and just define it as a regular function that can be stripped by the linker. Thoughts?
-Joe
participants (2)
-
Heinrich Schuchardt
-
Joe Hershberger