Skip to contentSkip to conversation

include/net.h: warning: 'eth_is_on_demand_init' defined but not used

U-Boot Heinrich Schuchardt 2 participants 2 messages Aug 30, 2019 – Sep 3, 2019

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

Hi Heinrich,

Quoted 30 lines · Heinrich Schuchardt

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

Quoted 7 lines

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