mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Put arguments in parantheses in assert macro definitions
This commit is contained in:
parent
0bb885dab2
commit
3c5930dd8e
@ -58,13 +58,13 @@ struct InvalidAstError: virtual util::Exception {};
|
||||
#endif
|
||||
|
||||
#define solAssert_1(CONDITION) \
|
||||
solAssert_2(CONDITION, "")
|
||||
solAssert_2((CONDITION), "")
|
||||
|
||||
#define solAssert_2(CONDITION, DESCRIPTION) \
|
||||
assertThrowWithDefaultDescription( \
|
||||
CONDITION, \
|
||||
(CONDITION), \
|
||||
::solidity::langutil::InternalCompilerError, \
|
||||
DESCRIPTION, \
|
||||
(DESCRIPTION), \
|
||||
"Solidity assertion failed" \
|
||||
)
|
||||
|
||||
@ -77,13 +77,13 @@ struct InvalidAstError: virtual util::Exception {};
|
||||
#endif
|
||||
|
||||
#define solUnimplementedAssert_1(CONDITION) \
|
||||
solUnimplementedAssert_2(CONDITION, "")
|
||||
solUnimplementedAssert_2((CONDITION), "")
|
||||
|
||||
#define solUnimplementedAssert_2(CONDITION, DESCRIPTION) \
|
||||
assertThrowWithDefaultDescription( \
|
||||
CONDITION, \
|
||||
(CONDITION), \
|
||||
::solidity::langutil::UnimplementedFeatureError, \
|
||||
DESCRIPTION, \
|
||||
(DESCRIPTION), \
|
||||
"Unimplemented feature" \
|
||||
)
|
||||
|
||||
@ -105,9 +105,9 @@ struct InvalidAstError: virtual util::Exception {};
|
||||
|
||||
#define astAssert_2(CONDITION, DESCRIPTION) \
|
||||
assertThrowWithDefaultDescription( \
|
||||
CONDITION, \
|
||||
(CONDITION), \
|
||||
::solidity::langutil::InvalidAstError, \
|
||||
DESCRIPTION, \
|
||||
(DESCRIPTION), \
|
||||
"AST assertion failed" \
|
||||
)
|
||||
|
||||
|
@ -38,13 +38,13 @@ struct SMTLogicError: virtual util::Exception {};
|
||||
#endif
|
||||
|
||||
#define smtAssert_1(CONDITION) \
|
||||
smtAssert_2(CONDITION, "")
|
||||
smtAssert_2((CONDITION), "")
|
||||
|
||||
#define smtAssert_2(CONDITION, DESCRIPTION) \
|
||||
assertThrowWithDefaultDescription( \
|
||||
CONDITION, \
|
||||
(CONDITION), \
|
||||
::solidity::smtutil::SMTLogicError, \
|
||||
DESCRIPTION, \
|
||||
(DESCRIPTION), \
|
||||
"SMT assertion failed" \
|
||||
)
|
||||
|
||||
|
@ -63,7 +63,7 @@ inline std::string stringOrDefault(std::string _string, std::string _defaultStri
|
||||
if (!(_condition)) \
|
||||
solThrow( \
|
||||
_exceptionType, \
|
||||
::solidity::util::assertions::stringOrDefault(_description, _defaultDescription) \
|
||||
::solidity::util::assertions::stringOrDefault((_description), (_defaultDescription)) \
|
||||
); \
|
||||
} \
|
||||
while (false)
|
||||
@ -72,6 +72,6 @@ inline std::string stringOrDefault(std::string _string, std::string _defaultStri
|
||||
/// Use it as assertThrow(1 == 1, ExceptionType, "Mathematics is wrong.");
|
||||
/// The second parameter must be an exception class (rather than an instance).
|
||||
#define assertThrow(_condition, _exceptionType, _description) \
|
||||
assertThrowWithDefaultDescription(_condition, _exceptionType, _description, "Assertion failed")
|
||||
assertThrowWithDefaultDescription((_condition), _exceptionType, (_description), "Assertion failed")
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ struct Exception: virtual std::exception, virtual boost::exception
|
||||
#define solThrow(_exceptionType, _description) \
|
||||
::boost::throw_exception( \
|
||||
_exceptionType() << \
|
||||
::solidity::util::errinfo_comment(_description) << \
|
||||
::solidity::util::errinfo_comment((_description)) << \
|
||||
::boost::throw_function(ETH_FUNC) << \
|
||||
::boost::throw_file(__FILE__) << \
|
||||
::boost::throw_line(__LINE__) \
|
||||
|
@ -63,13 +63,13 @@ struct StackTooDeepError: virtual YulException
|
||||
#endif
|
||||
|
||||
#define yulAssert_1(CONDITION) \
|
||||
yulAssert_2(CONDITION, "")
|
||||
yulAssert_2((CONDITION), "")
|
||||
|
||||
#define yulAssert_2(CONDITION, DESCRIPTION) \
|
||||
assertThrowWithDefaultDescription( \
|
||||
CONDITION, \
|
||||
(CONDITION), \
|
||||
::solidity::yul::YulAssertion, \
|
||||
DESCRIPTION, \
|
||||
(DESCRIPTION), \
|
||||
"Yul assertion failed" \
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user