Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCTEST_BREAK_INTO_DEBUGGER undefined under OSX #22

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

DOCTEST_BREAK_INTO_DEBUGGER undefined under OSX #22

pthom opened this issue Jun 4, 2016 · 7 comments

Comments

@pthom
Copy link

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
Copy link
Member

onqtam commented Jun 4, 2016

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
Copy link
Author

pthom commented Jun 4, 2016

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

@pthom
Copy link
Author

pthom commented Jun 4, 2016

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

@pthom
Copy link
Author

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
Copy link

ongamex commented Jun 4, 2016

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

@netheril96
Copy link

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
Copy link

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

onqtam added a commit that referenced this issue Jun 8, 2016
@onqtam onqtam closed this as completed in 795d5f5 Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants