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
|
#endif
|
||||||
|
|
||||||
#define solAssert_1(CONDITION) \
|
#define solAssert_1(CONDITION) \
|
||||||
solAssert_2(CONDITION, "")
|
solAssert_2((CONDITION), "")
|
||||||
|
|
||||||
#define solAssert_2(CONDITION, DESCRIPTION) \
|
#define solAssert_2(CONDITION, DESCRIPTION) \
|
||||||
assertThrowWithDefaultDescription( \
|
assertThrowWithDefaultDescription( \
|
||||||
CONDITION, \
|
(CONDITION), \
|
||||||
::solidity::langutil::InternalCompilerError, \
|
::solidity::langutil::InternalCompilerError, \
|
||||||
DESCRIPTION, \
|
(DESCRIPTION), \
|
||||||
"Solidity assertion failed" \
|
"Solidity assertion failed" \
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ struct InvalidAstError: virtual util::Exception {};
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define solUnimplementedAssert_1(CONDITION) \
|
#define solUnimplementedAssert_1(CONDITION) \
|
||||||
solUnimplementedAssert_2(CONDITION, "")
|
solUnimplementedAssert_2((CONDITION), "")
|
||||||
|
|
||||||
#define solUnimplementedAssert_2(CONDITION, DESCRIPTION) \
|
#define solUnimplementedAssert_2(CONDITION, DESCRIPTION) \
|
||||||
assertThrowWithDefaultDescription( \
|
assertThrowWithDefaultDescription( \
|
||||||
CONDITION, \
|
(CONDITION), \
|
||||||
::solidity::langutil::UnimplementedFeatureError, \
|
::solidity::langutil::UnimplementedFeatureError, \
|
||||||
DESCRIPTION, \
|
(DESCRIPTION), \
|
||||||
"Unimplemented feature" \
|
"Unimplemented feature" \
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -105,9 +105,9 @@ struct InvalidAstError: virtual util::Exception {};
|
|||||||
|
|
||||||
#define astAssert_2(CONDITION, DESCRIPTION) \
|
#define astAssert_2(CONDITION, DESCRIPTION) \
|
||||||
assertThrowWithDefaultDescription( \
|
assertThrowWithDefaultDescription( \
|
||||||
CONDITION, \
|
(CONDITION), \
|
||||||
::solidity::langutil::InvalidAstError, \
|
::solidity::langutil::InvalidAstError, \
|
||||||
DESCRIPTION, \
|
(DESCRIPTION), \
|
||||||
"AST assertion failed" \
|
"AST assertion failed" \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,13 +38,13 @@ struct SMTLogicError: virtual util::Exception {};
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define smtAssert_1(CONDITION) \
|
#define smtAssert_1(CONDITION) \
|
||||||
smtAssert_2(CONDITION, "")
|
smtAssert_2((CONDITION), "")
|
||||||
|
|
||||||
#define smtAssert_2(CONDITION, DESCRIPTION) \
|
#define smtAssert_2(CONDITION, DESCRIPTION) \
|
||||||
assertThrowWithDefaultDescription( \
|
assertThrowWithDefaultDescription( \
|
||||||
CONDITION, \
|
(CONDITION), \
|
||||||
::solidity::smtutil::SMTLogicError, \
|
::solidity::smtutil::SMTLogicError, \
|
||||||
DESCRIPTION, \
|
(DESCRIPTION), \
|
||||||
"SMT assertion failed" \
|
"SMT assertion failed" \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ inline std::string stringOrDefault(std::string _string, std::string _defaultStri
|
|||||||
if (!(_condition)) \
|
if (!(_condition)) \
|
||||||
solThrow( \
|
solThrow( \
|
||||||
_exceptionType, \
|
_exceptionType, \
|
||||||
::solidity::util::assertions::stringOrDefault(_description, _defaultDescription) \
|
::solidity::util::assertions::stringOrDefault((_description), (_defaultDescription)) \
|
||||||
); \
|
); \
|
||||||
} \
|
} \
|
||||||
while (false)
|
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.");
|
/// Use it as assertThrow(1 == 1, ExceptionType, "Mathematics is wrong.");
|
||||||
/// The second parameter must be an exception class (rather than an instance).
|
/// The second parameter must be an exception class (rather than an instance).
|
||||||
#define assertThrow(_condition, _exceptionType, _description) \
|
#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) \
|
#define solThrow(_exceptionType, _description) \
|
||||||
::boost::throw_exception( \
|
::boost::throw_exception( \
|
||||||
_exceptionType() << \
|
_exceptionType() << \
|
||||||
::solidity::util::errinfo_comment(_description) << \
|
::solidity::util::errinfo_comment((_description)) << \
|
||||||
::boost::throw_function(ETH_FUNC) << \
|
::boost::throw_function(ETH_FUNC) << \
|
||||||
::boost::throw_file(__FILE__) << \
|
::boost::throw_file(__FILE__) << \
|
||||||
::boost::throw_line(__LINE__) \
|
::boost::throw_line(__LINE__) \
|
||||||
|
@ -63,13 +63,13 @@ struct StackTooDeepError: virtual YulException
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define yulAssert_1(CONDITION) \
|
#define yulAssert_1(CONDITION) \
|
||||||
yulAssert_2(CONDITION, "")
|
yulAssert_2((CONDITION), "")
|
||||||
|
|
||||||
#define yulAssert_2(CONDITION, DESCRIPTION) \
|
#define yulAssert_2(CONDITION, DESCRIPTION) \
|
||||||
assertThrowWithDefaultDescription( \
|
assertThrowWithDefaultDescription( \
|
||||||
CONDITION, \
|
(CONDITION), \
|
||||||
::solidity::yul::YulAssertion, \
|
::solidity::yul::YulAssertion, \
|
||||||
DESCRIPTION, \
|
(DESCRIPTION), \
|
||||||
"Yul assertion failed" \
|
"Yul assertion failed" \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user