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)
Jan 24 2024, 6:53 PM
Unknown Object (File)
Jan 20 2024, 3:08 AM
Unknown Object (File)
Dec 23 2023, 3:50 PM
Unknown Object (File)
Dec 20 2023, 8:06 AM
Unknown Object (File)
Dec 12 2023, 2:35 AM
Unknown Object (File)
Nov 24 2023, 7:25 PM
Unknown Object (File)
Nov 22 2023, 3:01 PM
Unknown Object (File)
Nov 13 2023, 6:59 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40018
Build 36907: arc lint + arc unit