DOCTEST_BREAK_INTO_DEBUGGER undefined under OSX #22

Closed
pthom opened this Issue Jun 4, 2016 · 7 comments

Projects

None yet

4 participants

@pthom
pthom commented Jun 4, 2016

Hi,

When I use doctest with my Mac (up-to-date XCode :-), DOCTEST_BREAK_INTO_DEBUGGER is not defined.

Steps to reproduce :
Clone https://github.com/pthom/DocTest_LibTest and compile on a mac (cmake / make)

See for example
https://github.com/pthom/DocTest_LibTest/blob/master/MyLibrary/lib1.cpp
where I had to define it in order to avoid an error

Thanks !

@onqtam
Owner
onqtam commented Jun 4, 2016 edited

my guess is that DEBUG (see here) isn't defined when xcode is used as the generator - a friend already told me about this - I hadn't tested it - will fix. This was taken directly from Catch so I supposed it would work for OSX...

@pthom
pthom commented Jun 4, 2016

Actually I was using the make generator : just type cmake then make
Hope this helps

@pthom
pthom commented Jun 4, 2016

Same issue if I write cmake -DCMAKE_BUILD_TYPE=Debug or Release

@pthom
pthom commented Jun 4, 2016

If I define DEBUG it will work.
However, my guess is that cmake defines NDEBUG for release builds, and nothing for debug builds (which is unfortunate). May be this should go in the readme.

See http://stackoverflow.com/questions/8591762/ifdef-debug-with-cmake-independent-from-platform

@ongamex
ongamex commented Jun 4, 2016 edited

Hmm, "NDEBUG" should be defined for non-debug builds under clang and gcc if remember correctly.

@netheril96

Wrapping DOCTEST_BREAK_INTO_DEBUGGER in a #ifdef DEBUG is really unnecessary, since the extra code generated when defined is very small, while not defining it makes it a pain to use. People do run optimized code under debuggers. In other words, this is but a useless premature optimization. Yes, Catch does it, and that is equally pointless.

@netheril96

In fact, the DEBUG guard is only present for OS X targets, but not Windows and Linux targets. An inconsistent design.

@onqtam onqtam closed this in 795d5f5 Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment