Skip to content

Commit

Permalink
Fix windows optional_throw
Browse files Browse the repository at this point in the history
  • Loading branch information
emilydolson committed Nov 26, 2023
1 parent 6626860 commit 58c6d81
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion include/emp/base/_optional_throw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace emp {
template <typename... EXTRA>
void assert_throw(std::string filename, size_t line, std::string expr, std::string message, EXTRA &&... extra) {
std::stringstream ss;
ss << "Internal Error (in " << filename << " line " << line << "): " << expr << ".\n\n Message: " << message << "\nn";
ss << "Internal Error (in " << filename << " line " << line << "): " << expr << ".\n\n Message: " << message << "\n\n";
assert_print_first(ss, std::forward<EXTRA>(extra)...);
throw(std::runtime_error(ss.str()));
}
Expand Down
32 changes: 16 additions & 16 deletions include/emp/base/optional_throw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,33 @@

#if defined( IN_PYTHON )

#if defined (_MSC_VER )
// #if defined (_MSC_VER )

#define emp_optional_throw_mscv_impl(TEST, MESSAGE) \
#define emp_optional_throw(TEST, MESSAGE) \
do { \
if (!(TEST)) { \
emp::assert_throw(__FILE__, __LINE__, #TEST, MESSAGE, 0); \
} \
} while(0)

#define emp_optional_throw_impl(TEST, MESSAGE) emp_optional_throw_mscv_impl(TEST, MESSAGE)
// #define emp_optional_throw_impl(TEST, MESSAGE) emp_optional_throw_mscv_impl(TEST, MESSAGE)

#else
// #else

#define emp_optional_throw_impl(...) \
do { \
if (!(emp_assert_GET_ARG_1(__VA_ARGS__, ~))) { \
emp::assert_throw( \
__FILE__, __LINE__, \
emp_assert_STRINGIFY( emp_assert_GET_ARG_1(__VA_ARGS__, ~), ), \
emp_assert_STRINGIFY( emp_assert_GET_ARG_2(__VA_ARGS__, ~), ), \
emp_assert_TO_PAIRS(__VA_ARGS__)); \
} \
} while(0)
// #define emp_optional_throw_impl(...) \
// do { \
// if (!(emp_assert_GET_ARG_1(__VA_ARGS__, ~))) { \
// emp::assert_throw( \
// __FILE__, __LINE__, \
// emp_assert_STRINGIFY( emp_assert_GET_ARG_1(__VA_ARGS__, ~), ), \
// emp_assert_STRINGIFY( emp_assert_GET_ARG_2(__VA_ARGS__, ~), ), \
// emp_assert_TO_PAIRS(__VA_ARGS__)); \
// } \
// } while(0)

#endif
// #endif

#define emp_optional_throw(...) emp_optional_throw_impl(__VA_ARGS__)
// #define emp_optional_throw(...) emp_optional_throw_impl(__VA_ARGS__)

#elif defined( EMP_NDEBUG )

Expand Down

0 comments on commit 58c6d81

Please sign in to comment.