Same as #1517, but for the CMakle build system.
The second commit improves the configure summary (similar to https://github.com/hebasto/bitcoin/pull/189.
Same as #1517, but for the CMakle build system.
The second commit improves the configure summary (similar to https://github.com/hebasto/bitcoin/pull/189.
Concept ACK
0 | @@ -0,0 +1,16 @@ 1 | +include_guard(GLOBAL) 2 | +include(CheckCSourceCompiles) 3 | + 4 | +function(check_memory_sanitizer output) 5 | + set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 6 | + check_c_source_compiles(" 7 | + #if defined(__has_feature) 8 | + # if __has_feature(memory_sanitizer) 9 | + // MemorySanitizer is enabled.
nit: We should probably use the same test program on configure and CMake (and perhaps avoid // comments which are invalid in C89, though that really is more of a philosophical concern.)
nit: We should probably use the same test program on configure and CMake
I'd prefer to align Autotools' SECP_MSAN_CHECK code with CMake's check_memory_sanitizer to keep the latter straightforward without negated values.
... and perhaps avoid
//comments which are invalid in C89
Thanks. Fixed.
I'd prefer to align Autotools'
SECP_MSAN_CHECKcode with CMake'scheck_memory_sanitizerto keep the latter straightforward without negated values.
Fine with that if you want to add a commit that makes them consistent, but then we'll also need to #error if !defined(__has_feature).
I'd prefer to align Autotools'
SECP_MSAN_CHECKcode with CMake'scheck_memory_sanitizerto keep the latter straightforward without negated values.Fine with that if you want to add a commit that makes them consistent, but then we'll also need to
#errorif!defined(__has_feature).
Thanks! Fixed.
262 | @@ -263,6 +263,17 @@ endif() 263 | 264 | set(CMAKE_C_VISIBILITY_PRESET hidden) 265 | 266 | +set(print_msan_notice) 267 | +if(SECP256K1_BUILD_CTIME_TESTS AND CMAKE_C_COMPILER_ID MATCHES "^(Clang|AppleClang)$")
Does Apple Clang makes sense here?
Actually, why are you hard coding compiler IDs at all? This just makes things less flexible, and the check should be enough.
Yeah, I had the same thought. It saves a test compilation for GCC, but it's probably simpler to drop the check for clang. In #1517, I also added a similar check (but for "GCC or Clang", so it's much more useless). Let's just drop it.
Thanks, do you want to add a commit that also removes the $GCC check in configure.ac, just to keep the system consistent?
Addressed comments:
avoid
//comments which are invalid in C89
Actually, why are you hard coding compiler IDs at all? This just makes things less flexible, and the check should be enough.
Clang >= 16 has `-fsanitize-memory-param-retval` turned on by default,
which is incompatible with
This change makes both Autotools and CMake build systems consistent.
Addressed comments:
... to add a commit that makes them consistent, but then we'll also need to
#errorif!defined(__has_feature).
... to add a commit that also removes the $GCC check in configure.ac, just to keep the system consistent
ACK f55703ba49454fc46226f4846fe292d4a3dfa3ef