[CMake] Tests with assert and Release build type
Ruslan Baratov
ruslan_baratov at yahoo.com
Thu Dec 24 11:20:59 EST 2015
On 24-Dec-15 19:46, Magnus Therning wrote:
> I'm *not* mixing stuff built with `-g` and stuff built without it.
Actually I don't see anything bad about mixing `-g` code with code
without `-g`.
> I'm
> also *not* mixing linking with debug- and non-debug libraries.
Since we cover a lot of aspects please specify what you mean by debug
and non-debug libraries.
> I'm only mixing stuff build with `-DNDEBUG` and stuff built without it.
see below
On 24-Dec-15 19:48, Magnus Therning wrote:
> Ruslan Baratov writes:
>
>> On 22-Dec-15 04:07, Magnus Therning wrote:
>>
>> It is possible to hit situation when ODR will be violated, e.g. if
>> somebody define optional member in structure with "#if defined(NDEBUG)"
>> condition. Something like this:
>> http://stackoverflow.com/questions/20833226/library-headers-and-define
> Yes, if we ever start using the NDEBUG macro to control anything in our
> code then I'll have to worry about this, as it stands right now it's
> only the `assert` from `assert.h` that cares about it.
Even if you care only about `assert` somebody can define different type
of structures based on value of NDEBUG. I'm talking about 3rd party
library that you can use and you can't control. If this will lead to ODR
violation then bug is NOT in 3rd party code, but in YOUR code. That's my
point. You can mix c++11 with c++98, libc++ with libstdc++, mingw with
cygwin, mingw with Visual Studio, NDEBUG with non NDEBUG, and it MAY
works, but when something suddenly will stop working with very obscure
errors that it's YOUR fault and not 3rd party.//
> If I'm reading you correctly you are advocating I simply get rid of the
> use of those asserts altogether instead.
I'm not sure what you mean. I'm just telling that if you want do some
runtime checks even when NDEBUG is OFF then you should introduce your
own macro FOO_DEBUG. Difference is about global/local affects.
Ruslo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151224/b7c5c570/attachment.html>
More information about the CMake
mailing list