Page MenuHomeFreeBSD

libalias: Fix compile time warning about unused functions
ClosedPublic

Authored by donner on Jun 21 2021, 3:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 5:37 AM
Unknown Object (File)
Wed, Nov 13, 6:21 PM
Unknown Object (File)
Oct 28 2024, 12:10 AM
Unknown Object (File)
Oct 14 2024, 3:27 PM
Unknown Object (File)
Oct 14 2024, 3:27 PM
Unknown Object (File)
Oct 14 2024, 3:27 PM
Unknown Object (File)
Oct 14 2024, 3:04 PM
Unknown Object (File)
Sep 30 2024, 9:45 PM
Subscribers

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
Lint Not Applicable
Unit
Tests Not Applicable