Skip to content

Commit

Permalink
Fix emscripten; use minimal trap on all GCCs
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrahams committed Aug 20, 2024
1 parent 079f5f2 commit b79dcf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/adobe/contract_checks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 8 additions & 0 deletions test/minimal_configuration_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b79dcf1

Please sign in to comment.