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

Compile without exceptions #277

Open
MarkusRannare opened this issue Aug 30, 2022 · 1 comment
Open

Compile without exceptions #277

MarkusRannare opened this issue Aug 30, 2022 · 1 comment

Comments

@MarkusRannare
Copy link

I'm currently working in a environment where exceptions is disabled (No /EHxx flags in MSVC and _HAS_EXCEPTIONS=0).
When I compile I get the warning:
"C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc"

Is it possible to compile a exceptions free version? Something like: DOCTEST_CONFIG_NO_EXCEPTIONS
I couldn't find any options in the source?

If not, would it be feasible to implement it, and would it be something of interest?

@rollbear
Copy link
Owner

With difficulty, but I'll see what I can do. It's possible to use with clang/gcc with -fno-exceptions, provided that you use a reporter that does not throw. However, to rid the Trompeloeil code itself of try/catch/throw is not that easy, since it intercepts throwing by the mock RETURN/SIDE_EFFECT/WITH, etc.

Generally I recommend building your unit tests with exceptions enabled, even if your production code is built without it, but I understand that this is not always feasible.

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