Skip to content

refactor: Add more MAYBE_UNUSED annotations - #104

Open
fanquake wants to merge 2 commits into
bitcoin-core:masterfrom
fanquake:more_maybe_unused
Open

fanquake wants to merge 2 commits into
bitcoin-core:masterfrom
fanquake:more_maybe_unused

Conversation

@fanquake

@fanquake fanquake commented Sep 9, 2026

Copy link
Copy Markdown
Member

This would be useful downstream, see bitcoin/bitcoin#36167.

@fanquake

Copy link
Copy Markdown
Member Author

Split the constexpr change into #105.

@fanquake

fanquake commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

I see the build failure here is correct. Fixing up.

@fanquake

fanquake commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Rebased over #106 and fixed the build issue.

@hodlinator hodlinator left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ACK ab0f8cc

Tested building PR base with unused-parameter warnings enabled:

cmake -B build -DCMAKE_CXX_FLAGS="-g -O2 -Werror=unused-parameter" && cmake --build build -j
...
In file included from /home/hodlinator/minisketch/src/fields/generic_5bytes.cpp:12:
In file included from /home/hodlinator/minisketch/src/fields/generic_common_impl.h:12:
/home/hodlinator/minisketch/src/fields/../int_utils.h:242:44: error: unused parameter 'a' [-Werror,-Wunused-parameter]
  242 |     static inline constexpr I Run(const I& a, const I& b) { return I(0); }
      |                                            ^
/home/hodlinator/minisketch/src/fields/../int_utils.h:242:56: error: unused parameter 'b' [-Werror,-Wunused-parameter]
  242 |     static inline constexpr I Run(const I& a, const I& b) { return I(0); }
      |                                                        ^

Also tested on PR head with this diff applied:

--- a/src/fields/clmul_1byte.cpp
+++ b/src/fields/clmul_1byte.cpp
@@ -83,14 +83,8 @@ typedef Field<uint8_t, 8, 27, StatTable8, &SQR_TABLE_8, &SQR2_TABLE_8, &QRT_TABL
 #endif
 }
 
-Sketch* ConstructClMul1Byte(int bits, MAYBE_UNUSED int implementation) {
+Sketch* ConstructClMul1Byte(int bits, int implementation) {
     switch (bits) {
-#ifdef ENABLE_FIELD_INT_5
-    case 5: return new SketchImpl<Field5>(implementation, 5);
-#endif
-#ifdef ENABLE_FIELD_INT_8
-    case 8: return new SketchImpl<Field8>(implementation, 8);
-#endif
     }
     return nullptr;
 }

which results in:

/home/hodlinator/minisketch/src/fields/clmul_1byte.cpp:86:43: error: unused parameter 'implementation' [-Werror,-Wunused-parameter]
   86 | Sketch* ConstructClMul1Byte(int bits, int implementation) {
      |                                           ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants