Actions
Bug #760
closedCompiling against UST with Clang generates unused functions
Status:
Resolved
Priority:
Low
Assignee:
-
Target version:
-
Start date:
03/11/2014
Due date:
% Done:
100%
Estimated time:
Description
For example, compiling hello.c with Clang 3.4 generates the following warnings:
$ clang -O2 -I. -o hello hello.c tp.c -ldl -llttng-ust -Wunused-function In file included from tp.c:26: ./ust_tests_hello.h:32:1: warning: unused function '__tracepoint_cb_ust_tests_hello___tptest' [-Wunused-function] TRACEPOINT_EVENT(ust_tests_hello, tptest, ^ /usr/include/lttng/tracepoint.h:506:2: note: expanded from macro 'TRACEPOINT_EVENT' _DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ ^ /usr/include/lttng/tracepoint.h:158:6: note: expanded from macro '_DECLARE_TRACEPOINT' void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ ^ <scratch space>:49:1: note: expanded from here __tracepoint_cb_ust_tests_hello___tptest ^ In file included from tp.c:26: ./ust_tests_hello.h:57:1: warning: unused function '__tracepoint_cb_ust_tests_hello___tptest_sighandler' [-Wunused-function] TRACEPOINT_EVENT(ust_tests_hello, tptest_sighandler, ^ /usr/include/lttng/tracepoint.h:506:2: note: expanded from macro 'TRACEPOINT_EVENT' _DECLARE_TRACEPOINT(provider, name, _TP_PARAMS(args)) \ ^ /usr/include/lttng/tracepoint.h:158:6: note: expanded from macro '_DECLARE_TRACEPOINT' void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \ ^ <scratch space>:80:1: note: expanded from here __tracepoint_cb_ust_tests_hello___tptest_sighandler ^ 2 warnings generated.
This problem does not appear when using gcc. And changing -O2 to -O0 keeps the same behavior (no warnings with GCC, same warning withc Clang), so it doesn't look like a case of functions being optimized out.
Updated by Anonymous about 11 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset 17ca060039dadc36eff49429af850c95659ab471.
Actions