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

Exception handlers cause warnings when exceptions are disabled #44

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

Comments

@nikoladimitroff
Copy link

nikoladimitroff commented Oct 29, 2016

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 added a commit that referenced this issue Nov 8, 2016
@onqtam
Copy link
Member

onqtam commented Nov 8, 2016

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 Exception handlers causing warnings Exception handlers cause warnings when exceptions are disabled Nov 8, 2016
@nikoladimitroff
Copy link
Author

@onqtam Works as expected!

onqtam added a commit that referenced this issue Nov 15, 2016
…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
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

2 participants