-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Enable -Wunused
and clean up found instances
#96949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Resolves llvm#96689 Updates `compile_options` in the `LLVMLibCObjectRules` CMake script.
@nickdesaulniers |
@llvm/pr-subscribers-libc Author: Rajveer Singh Bharadwaj (Rajveer100) ChangesResolves #96689 Updates Full diff: https://github.com/llvm/llvm-project/pull/96949.diff 1 Files Affected:
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 134c5143d6d61..c53548a1294e4 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -50,6 +50,8 @@ function(create_object_library fq_target_name)
_get_common_compile_options(compile_options "${ADD_OBJECT_FLAGS}")
list(APPEND compile_options ${ADD_OBJECT_COMPILE_OPTIONS})
+ list(APPEND compile_options -Wunused)
+
add_library(
${fq_target_name}
EXCLUDE_FROM_ALL
@@ -251,6 +253,9 @@ function(create_entrypoint_object fq_target_name)
endif()
_get_common_compile_options(common_compile_options "${ADD_ENTRYPOINT_OBJ_FLAGS}")
+
+ list(APPEND common_compile_options -Wunused)
+
list(APPEND common_compile_options ${ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS})
get_fq_deps_list(fq_deps_list ${ADD_ENTRYPOINT_OBJ_DEPENDS})
set(full_deps_list ${fq_deps_list} libc.src.__support.common)
|
@michaelrj-google |
any instances found by the warning? |
Well, I might not be checking the right way, I did not see any warnings show up (apart from How would you do it @SchrodingerZhu ? |
One possible way might be to reintroduce the unused variables mentioned in the comment here (#96591 (comment)) and rebuild to see if warnings are emitted with your change. |
hi, yes I can review this. It got lost in my inbox so I just now saw it. For cleanup that's just running a build (probably with |
I have been facing this issue actually (via Undefined symbols for architecture arm64:
"__llvm_libc_19_0_0_git::internal::exit(int)", referenced from:
__llvm_libc_19_0_0_git::BlockStore<int, 4ul, false>::pop_back() in blockstore_test.cpp.o
__llvm_libc_19_0_0_git::BlockStore<int, 4ul, false>::get_last_blocks() in blockstore_test.cpp.o
__llvm_libc_19_0_0_git::BlockStore<int, 4ul, true>::pop_back() in blockstore_test.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation) Undefined symbols for architecture arm64:
"__llvm_libc_19_0_0_git::internal::exit(int)", referenced from:
__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>*, unsigned long, unsigned long) in block_test.cpp.o
__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>*, unsigned long, unsigned long) in block_test.cpp.o
__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>*, unsigned long, unsigned long) in block_test.cpp.o
__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned long long, 8ul>*, unsigned long, unsigned long) in block_test.cpp.o
__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>*, unsigned long, unsigned long) in block_test.cpp.o
__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>*, unsigned long, unsigned long) in block_test.cpp.o
__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>*, unsigned long, unsigned long) in block_test.cpp.o
__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>::allocate(__llvm_libc_19_0_0_git::Block<unsigned short, 2ul>*, unsigned long, unsigned long) in block_test.cpp.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation) |
This is probably related to #97642 |
@michaelrj-google It was not triggered for the the specific case: FPBits sk_cy(sin_k_cos_y.hi);
FPBits ck_sy(cos_k_sin_y.hi); But works for:
Considering this, I think this PR and the linked issue can be closed? |
I think |
Great, closing this one. |
Resolves #96689
Updates
compile_options
in theLLVMLibCObjectRules
CMake script.