Skip to content

refactor: prefix external config macros with SECP256K1_#1833

Open
w0xlt wants to merge 6 commits intobitcoin-core:masterfrom
w0xlt:prefix-macros-secp256k1
Open

refactor: prefix external config macros with SECP256K1_#1833
w0xlt wants to merge 6 commits intobitcoin-core:masterfrom
w0xlt:prefix-macros-secp256k1

Conversation

@w0xlt
Copy link
Contributor

@w0xlt w0xlt commented Mar 3, 2026

This PR renames 22 externally-configured preprocessor macros (set via -D flags in configure.ac / CMakeLists.txt) to use the SECP256K1_ prefix, addressing part of #1449.

Renamed macros:

  • ENABLE_MODULE_{ECDH,RECOVERY,EXTRAKEYS,SCHNORRSIG,MUSIG,ELLSWIFT}
  • VERIFY
  • USE_ASM_X86_64, USE_EXTERNAL_ASM, USE_FORCE_WIDEMUL_{INT128,INT128_STRUCT,INT64}, USE_EXTERNAL_DEFAULT_CALLBACKS
  • ECMULT_WINDOW_SIZE, COMB_BLOCKS, COMB_TEETH
  • EXHAUSTIVE_TEST_ORDER
  • DETERMINISTIC, COVERAGE, VALGRIND, DEBUG_CONFIG, SUPPORTS_CONCURRENCY

These macros are defined via -D compiler flags during the build. Generic names like VERIFY, COVERAGE, and DETERMINISTIC can clash with flags from projects that build secp256k1 from source.

These are macros relatively safe to rename: they are defined entirely by the build system, do not affect the public API or ABI, and have no interdependencies with internal macros. If this approach is accepted, the same pattern can be applied to the remaining internal macros identified in #1449.

w0xlt added 6 commits March 3, 2026 08:18
Rename all ENABLE_MODULE_{ECDH,RECOVERY,EXTRAKEYS,SCHNORRSIG,MUSIG,
ELLSWIFT} preprocessor macros to SECP256K1_ENABLE_MODULE_* to avoid
namespace collisions and ensure consistency with the library's naming
convention.
Rename the standalone VERIFY preprocessor config macro to
SECP256K1_VERIFY. This does not affect VERIFY_CHECK or other
compound macros which will be addressed separately.

Updates build definitions in Makefile.am, src/CMakeLists.txt,
and CI configuration.
Rename USE_ASM_X86_64, USE_EXTERNAL_ASM, USE_FORCE_WIDEMUL_INT128,
USE_FORCE_WIDEMUL_INT128_STRUCT, USE_FORCE_WIDEMUL_INT64, and
USE_EXTERNAL_DEFAULT_CALLBACKS to their SECP256K1_ prefixed
equivalents.

Updates configure.ac and CMakeLists.txt build definitions alongside
all source file references.
…P256K1_

Rename the externally configurable ecmult parameter macros to use the
SECP256K1_ prefix, preventing namespace collisions when the library
is used in header-only mode.
Rename the EXHAUSTIVE_TEST_ORDER config macro used in exhaustive
test builds to SECP256K1_EXHAUSTIVE_TEST_ORDER to follow the
library's naming convention.
…PORTS_CONCURRENCY with SECP256K1_

Rename the remaining external config macros to use the SECP256K1_
prefix:

- DETERMINISTIC -> SECP256K1_DETERMINISTIC
- COVERAGE -> SECP256K1_COVERAGE
- VALGRIND -> SECP256K1_VALGRIND
- DEBUG_CONFIG -> SECP256K1_DEBUG_CONFIG
- SUPPORTS_CONCURRENCY -> SECP256K1_SUPPORTS_CONCURRENCY

Updates build definitions in configure.ac, CMakeLists.txt,
src/CMakeLists.txt, CI workflow, and all source file references.
@w0xlt w0xlt force-pushed the prefix-macros-secp256k1 branch from a8b2884 to 02b569d Compare March 3, 2026 16:21
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.

1 participant