Skip to content

Silence -Wunused-parameter warnings in Unwind-wasm.c #125412

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

Merged
merged 3 commits into from
Feb 17, 2025

Conversation

georgthegreat
Copy link
Contributor

No description provided.

@georgthegreat georgthegreat requested a review from a team as a code owner February 2, 2025 13:36
@llvmbot
Copy link
Member

llvmbot commented Feb 2, 2025

@llvm/pr-subscribers-libunwind

Author: Yuriy Chernyshov (georgthegreat)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/125412.diff

1 Files Affected:

  • (modified) libunwind/src/Unwind-wasm.c (+3-3)
diff --git a/libunwind/src/Unwind-wasm.c b/libunwind/src/Unwind-wasm.c
index b18b32c5d17847..fe016b8f5923ad 100644
--- a/libunwind/src/Unwind-wasm.c
+++ b/libunwind/src/Unwind-wasm.c
@@ -102,8 +102,8 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
 }
 
 /// Not used in Wasm.
-_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
-                                     uintptr_t value) {}
+_LIBUNWIND_EXPORT void _Unwind_SetIP([[maybe_unused]] struct _Unwind_Context *context,
+                                     [[maybe_unused]] uintptr_t value) {}
 
 /// Called by personality handler to get LSDA for current frame.
 _LIBUNWIND_EXPORT uintptr_t
@@ -116,7 +116,7 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
 
 /// Not used in Wasm.
 _LIBUNWIND_EXPORT uintptr_t
-_Unwind_GetRegionStart(struct _Unwind_Context *context) {
+_Unwind_GetRegionStart([[maybe_unused]] struct _Unwind_Context *context) {
   return 0;
 }
 

Copy link

github-actions bot commented Feb 2, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your build option?

llvm-project considers this warning low value and llvm/cmake/modules/HandleLLVMOptions.cmake specifies -Wno-unused-parameter.

@georgthegreat
Copy link
Contributor Author

@MaskRay, we build libunwind using our own build system with the clang default set of warnings enabled.

There is already a couple of [[maybe_unused]] attributes in this library, so I do not bring anything new:

(dflt) thegeorg@jakku:~/contrib/llvm/libunwind@main$ rg unused]]
src/Unwind-EHABI.cpp
890:[[gnu::unused]] static uint64_t

src/UnwindCursor.hpp
3050:  [[maybe_unused]] const int Result = syscall(

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is reasonable but it's simpler to drop the parameter names in this case, no need for [[maybe_unused]].

@georgthegreat
Copy link
Contributor Author

I applied @ldionne suggestions, I am fine with his approach.

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this, but I don't want to override @MaskRay 's (dis)approval since his opinion prevails on libunwind matters. If @MaskRay doesn't raise any concerns within a few days, I think this would be reasonable to merge since it's fairly harmless.

@georgthegreat
Copy link
Contributor Author

@ldionne, may we proceed with merging this?

@ldionne
Copy link
Member

ldionne commented Feb 15, 2025

Sure, but I am not certain why you added some newlines though. Can you leave the formatting as it was?

@georgthegreat
Copy link
Contributor Author

I think this is how my clang-format-16 auto-formatted it.
I have applied the formatting from the check, it is green now.

@ldionne ldionne merged commit f4206f9 into llvm:main Feb 17, 2025
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants