Support use in buids without exceptions

Issue #24 new
Gioffredo Linde
created an issue

First, xUnit++ looks quite nice and capable - Thank you for your hard work on this project!

This enhancement suggestion may be quite difficult - I have not explored the full scope of the work that might be required, but I did some initial exploration.


In some use cases, developers choose not to make use of exceptions in their code. In these cases it's desirable to be able to write tests which will compile with the same compiler flags as the code being tested.

xUnit++ depends on exceptions and turning them off explicitly in Visual Studio, results in the compiler suggesting adding /EHsc to the compile flags


In initial exploration I was able to remove some of the problems by adding /D_HAS_EXCEPTIONS=0 to my compile flags.

In addition, I added #ifdef _HAS_EXCEPTIONS around the throws and does not throw templates.

At this point what remains is several of the following warning

1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h(4774): error C3861: '__uncaught_exception': identifier not found

This comes from TestEventRecorder.h (and a few other files) including the msvc std header thread.h (which starts a chain of includes which eventually includes the concrt.h header)

At this point, I would need to know what role the map of thread id to function is playing. Does xUnit++ support running more than one test at a time? If yes, perhaps this is where you keep track of the running tests. If that's the case then, perhaps there could be a feature that allowed turning that off added?

Comments (2)

  1. Log in to comment