Frits van Bommel <fvbommel at wxs.nl> writes:> Paul Melis wrote: >> Just checked: yup, there's plenty of assert()'s in the headers, so >> -D_DEBUG will keep those alive. >> >> Interestingly, when configuring with --enable-optimized and >> --disable-assertions the resulting compilation calls itself a >> "Release-Asserts build" while all asserts are thrown away, hmmm :) > > Yeah, that's "Release-Asserts" as in "Release minus asserts". > > This has caused confusion before...Committed a change for the cmake build that implements the option LLVM_ENABLE_ASSERTS. Defaults to ON if and only if CMAKE_BUILD_TYPE is Release. -- Óscar
Hi,> Committed a change for the cmake build that implements the option > LLVM_ENABLE_ASSERTS. Defaults to ON if and only if CMAKE_BUILD_TYPE is > Release.Thanks! I think it might be nice to make this a bit more consistent with Makefile.config. I'd suggest... - use LLVM_DISABLE_ASSERTIONS instead of LLVM_ENABLE_ASSERTS - have it default to OFF (so assertions are enabled) always - compile with -DNDEBUG if assertions are off -- I don't think -UNDEBUG has any effect, because NDEBUG won't have been defined in the first place Thanks, Jay.
Jay Foad <jay.foad at gmail.com> writes:>> Committed a change for the cmake build that implements the option >> LLVM_ENABLE_ASSERTS. Defaults to ON if and only if CMAKE_BUILD_TYPE is >> Release. > > Thanks! I think it might be nice to make this a bit more consistent > with Makefile.config. I'd suggest... > > - use LLVM_DISABLE_ASSERTIONS instead of LLVM_ENABLE_ASSERTSOkay.> - have it default to OFF (so assertions are enabled) alwaysIMHO this is wrong: if the user asks for a release build, assertions should be turned off by default. The fact that the configure/make build does not follow this policy caused some surprise among the LLVM developers and users on the past. So it is the configure/make build the one that needs to be fixed :-)> - compile with -DNDEBUG if assertions are off --Good catch!> I don't think -UNDEBUG has any effect, because NDEBUG won't have been > defined in the first placeRight. For Release builds, cmake automatically defines NDEBUG. -- Óscar