Merge pull request #3156 from kjetilly/kjetilly_reserved_keyword_fix

Remove use of reserved identifier in OPM_THROW.
This commit is contained in:
Bård Skaflestad 2022-09-27 12:51:42 +02:00 committed by GitHub
commit 26a566ef94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,22 +49,22 @@
// std::runtime_error. // std::runtime_error.
// //
// Usage: OPM_THROW(ExceptionClass, "Error message " << value); // Usage: OPM_THROW(ExceptionClass, "Error message " << value);
#define OPM_THROW(Exception, message) \ #define OPM_THROW(Exception, message) \
do { \ do { \
std::ostringstream oss__; \ std::ostringstream opmErrorMacroOStringStream; \
oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \ opmErrorMacroOStringStream << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
::Opm::OpmLog::error(oss__.str()); \ ::Opm::OpmLog::error(opmErrorMacroOStringStream.str()); \
throw Exception(oss__.str()); \ throw Exception(opmErrorMacroOStringStream.str()); \
} while (false) } while (false)
// Same as OPM_THROW, except for not making an OpmLog::error() call. // Same as OPM_THROW, except for not making an OpmLog::error() call.
// //
// Usage: OPM_THROW_NOLOG(ExceptionClass, "Error message " << value); // Usage: OPM_THROW_NOLOG(ExceptionClass, "Error message " << value);
#define OPM_THROW_NOLOG(Exception, message) \ #define OPM_THROW_NOLOG(Exception, message) \
do { \ do { \
std::ostringstream oss__; \ std::ostringstream opmErrorMacroOStringStream; \
oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \ opmErrorMacroOStringStream << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
throw Exception(oss__.str()); \ throw Exception(opmErrorMacroOStringStream.str()); \
} while (false) } while (false)
// throw an exception if a condition is true // throw an exception if a condition is true