tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Unused functions in kernels



On Sun, 5 Jun 2016, Izumi Tsutsui wrote:

It should be static instead?  (note fpu_cordic.c was added in 2013)
https://nxr.netbsd.org/search?q=fpu_cordit2&project=src

It is only used when CORDIC_BOOTSTRAP is defined (i.e. when running as a standalone applicaion), so it should probably be moved into that section.

I wonder if others are really unused.
DCIU() is referred in sun3/sun3/sys_machdep.c and sun3/sun3/trap.c.
_Idle() is referred in sun3/sun3/clock.c, via an awful cast.
etc. etc.

DCIU() seems to be re-defined in sys/arch/m68k/include/cacheops.h
  #define DCIU()          DCIU_20()
so it does not seem like DCIU() from locore.s is used (and the kernel built when I #if 0:ed it...)

For _Idle, it looks like its use is protected by LED_IDLE_CHECK in clock.c, and LED_IDLE_CHECK is not set in in the GENERIC kernel...

That said, there are cases where my tool incorrectly claims symbols are unused:
* The symbol is only used in the file where it is defined, and all
  uses are inlined
* The symbol is used with STRONG_ALIAS or similar, that introduces
  new names

   /Krister


Home | Main Index | Thread Index | Old Index