Page MenuHomeFreeBSD

libalias: Fix compile time warning about unused functions
ClosedPublic

Authored by donner on Jun 21 2021, 3:26 PM.

Details

Summary

Compiling libalias results in a lot of warnings about unused functions.
This warning is caused by clang's heuristic to consider an inline
function as to be used, iff the declaration is in a *.c file.
Declarations in *.h files do not emit those warnings.

Hence the declarations must be moved to an approbriate *.h file.

Test Plan

Compile make buildkernel and watch the follwing warnings to disappear.

/usr/src/sys/netinet/libalias/alias_db.c:424:1: warning: unused function 'splay_out_SPLAY_NEXT' [-Wunused-function]
SPLAY_PROTOTYPE(splay_out, alias_link, all.out, cmp_out);
^
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/tree.h:139:36: note: expanded from macro 'SPLAY_PROTOTYPE'
static __inline struct type *                                           \
                                                                        ^
<scratch space>:33:1: note: expanded from here
splay_out_SPLAY_NEXT
^
/usr/src/sys/netinet/libalias/alias_db.c:424:1: warning: unused function 'splay_out_SPLAY_MIN_MAX' [-Wunused-function]
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/tree.h:153:36: note: expanded from macro 'SPLAY_PROTOTYPE'
static __inline struct type *                                           \
                                                                        ^
<scratch space>:35:1: note: expanded from here
splay_out_SPLAY_MIN_MAX
^
/usr/src/sys/netinet/libalias/alias_db.c:436:1: warning: unused function 'splay_in_SPLAY_NEXT' [-Wunused-function]
SPLAY_PROTOTYPE(splay_in, group_in, in, cmp_in);
^
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/tree.h:139:36: note: expanded from macro 'SPLAY_PROTOTYPE'
static __inline struct type *                                           \
                                                                        ^
<scratch space>:50:1: note: expanded from here
splay_in_SPLAY_NEXT
^
/usr/src/sys/netinet/libalias/alias_db.c:436:1: warning: unused function 'splay_in_SPLAY_MIN_MAX' [-Wunused-function]
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/sys/tree.h:153:36: note: expanded from macro 'SPLAY_PROTOTYPE'
static __inline struct type *                                           \
                                                                        ^
<scratch space>:52:1: note: expanded from here
splay_in_SPLAY_MIN_MAX
^

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.