diff --git a/include/adobe/contract_checks.hpp b/include/adobe/contract_checks.hpp index c72d697..b4e07c7 100644 --- a/include/adobe/contract_checks.hpp +++ b/include/adobe/contract_checks.hpp @@ -7,7 +7,7 @@ // ADOBE_MINIMAL_TRAP(): followed with a semicolon, expands to a // minimal statement that stops the program. -#if defined(__clang__) || defined(__GNUC__) && __GNUC__ < 10 +#if !defined(__EMSCRIPTEN__) && (defined(__clang__) || defined(__GNUC__)) #define ADOBE_MINIMAL_TRAP() __builtin_trap() #elif defined(_MSC_VER) #define ADOBE_MINIMAL_TRAP() __debugbreak() diff --git a/test/minimal_configuration_tests.cpp b/test/minimal_configuration_tests.cpp index 19e4c9a..ac10496 100644 --- a/test/minimal_configuration_tests.cpp +++ b/test/minimal_configuration_tests.cpp @@ -8,3 +8,11 @@ TEST(MinimalConfigurationDeathTests, FailedChecksDie) EXPECT_PORTABLE_DEATH(ADOBE_POSTCONDITION(false), ""); EXPECT_PORTABLE_DEATH(ADOBE_INVARIANT(false), ""); } + +// ****** This should be the last test in the file. ********* +// +// For unknown reasons if the last test is a death test, under +// emscripten, the test fails even if the executable aborts. +#if defined(__EMSCRIPTEN__) +TEST(MinimalConfiguration, EmscriptenDummy) {} +#endif