Exception handlers cause warnings when exceptions are disabled #44

Closed
nikoladimitroff opened this Issue Oct 29, 2016 · 2 comments

Projects

None yet

2 participants

@nikoladimitroff
nikoladimitroff commented Oct 29, 2016 edited

C++ exceptions in my opinion (and in the opinion of others) are subpar and I usually have them turned off along with RTTI. However,
the presence of try/catch blocks in doctest causes warnings (at least on MSVC - C4530) which can't be suppressed (and I'm building with /W4 /WX so this breaks my build).

I simply deleted / commented out all usages of try/catch in the my copy of the library but it will be helpful to only use exceptions handling if the user's exceptions are enabled. This can be detected by checking for

  • __cpp_exceptions on gcc
  • _HAS_EXCEPTIONS on MSVC
@onqtam onqtam added a commit that referenced this issue Nov 8, 2016
@onqtam introduced the DOCTEST_CONFIG_NO_EXCEPTIONS and DOCTEST_CONFIG_NO_TRY…
…_CATCH_IN_ASSERTS config identifiers

fixes #44
1f5d22a
@onqtam
Owner
onqtam commented Nov 8, 2016 edited

try the dev branch and let me know if everything works fine - also checkout these docs in the dev branch

U'll have to define DOCTEST_CONFIG_NO_EXCEPTIONS yourself because the auto detection using _HAS_EXCEPTIONS for MSVC requires that I include atleast 1 header (so vcruntime.h gets included). I could detect it sometimes - when the doctest header is not the first that is included in the translation unit (so _HAS_EXCEPTIONS is defined), but I decided to not complicate things.

@onqtam onqtam changed the title from Exception handlers causing warnings to Exception handlers cause warnings when exceptions are disabled Nov 8, 2016
@nikoladimitroff

@onqtam Works as expected!

@onqtam onqtam added a commit that referenced this issue Nov 15, 2016
@onqtam - added the ability to compile code with assertions that need excepti…
…ons even without exceptions - see the use of DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS

- added clang 3.9 to build matrix

relates #44
4402545
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment