[Mlir-commits] [llvm] [mlir] Fix LLVM_ENABLE_ABI_BREAKING_CHECKS macro check: use #if instead of #ifdef (PR #110185)

Dimitry Andric llvmlistbot at llvm.org
Thu Oct 24 01:45:05 PDT 2024


DimitryAndric wrote:

So in `llvm/cmake/modules/HandleLLVMOptions.cmake` there is this fragment:

```cmake
if( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "WITH_ASSERTS" )
  if( LLVM_ENABLE_ASSERTIONS )
    set( LLVM_ENABLE_ABI_BREAKING_CHECKS 1 )
  endif()
elseif( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "FORCE_ON" )
  set( LLVM_ENABLE_ABI_BREAKING_CHECKS 1 )
elseif( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "FORCE_OFF" )
  # We don't need to do anything special to turn off ABI breaking checks.
elseif( NOT DEFINED LLVM_ABI_BREAKING_CHECKS )
  # Treat LLVM_ABI_BREAKING_CHECKS like "FORCE_OFF" when it has not been
  # defined.
else()
  message(FATAL_ERROR "Unknown value for LLVM_ABI_BREAKING_CHECKS: \"${LLVM_ABI_BREAKING_CHECKS}\"!")
endif()
```

I thought we could maybe remove _all_ `NDEBUG` checks when used in combination with `LLVM_ENABLE_ABI_BREAKING_CHECKS`, but apparently you can "force on" `LLVM_ENABLE_ABI_BREAKING_CHECKS` even when `LLVM_ENABLE_ASSERTIONS` is off.

So for some reason, this is still a valid combination, although it does not really make sense to me. :)


https://github.com/llvm/llvm-project/pull/110185


More information about the Mlir-commits mailing list