10 #ifndef AZ_UCONTRACT_H 11 #define AZ_UCONTRACT_H 13 #include "azure_macro_utils/macro_utils.h" 15 #include "ulib_port.h" 25 #define EVALUATE_REQUIRE(x) x; 37 #define AZ_UCONTRACT(...) do { MU_FOR_EACH_1(EVALUATE_REQUIRE, __VA_ARGS__) } while((void)0,0) 46 #define AZ_UASSERT(...) 48 #define AZ_UASSERT(...) AZ_UCONTRACT(__VA_ARGS__) 58 #define AZ_UCONTRACT_REQUIRE(expression, result, msg) \ 62 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, msg); \ 74 #define AZ_UCONTRACT_REQUIRE_EQUALS(val, expected, result) \ 78 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, AZ_ULOG_REQUIRE_EQUALS_STRING, MU_TOSTRING(val), MU_TOSTRING(expected)); \ 90 #define AZ_UCONTRACT_REQUIRE_NOT_EQUALS(val, expected, result) \ 94 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, AZ_ULOG_REQUIRE_NOT_EQUALS_STRING, MU_TOSTRING(val), MU_TOSTRING(expected)); \ 105 #define AZ_UCONTRACT_REQUIRE_NOT_NULL(val, result) \ 109 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, AZ_ULOG_REQUIRE_NOT_NULL_STRING, MU_TOSTRING(val)); \ 122 #define AZ_UCONTRACT_REQUIRE_HARD_FAULT(expression, msg) \ 126 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, msg); \ 127 AZ_ULIB_PORT_THROW_HARD_FAULT; \ 139 #define AZ_UCONTRACT_REQUIRE_EQUALS_HARD_FAULT(val, expected) \ 141 if(val != expected) \ 143 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, AZ_ULOG_REQUIRE_EQUALS_STRING, MU_TOSTRING(val), MU_TOSTRING(expected)); \ 144 AZ_ULIB_PORT_THROW_HARD_FAULT; \ 156 #define AZ_UCONTRACT_REQUIRE_NOT_EQUALS_HARD_FAULT(val, expected) \ 158 if(val == expected) \ 160 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, AZ_ULOG_REQUIRE_NOT_EQUALS_STRING, MU_TOSTRING(val), MU_TOSTRING(expected)); \ 161 AZ_ULIB_PORT_THROW_HARD_FAULT; \ 172 #define AZ_UCONTRACT_REQUIRE_NOT_NULL_HARD_FAULT(val) \ 176 AZ_ULIB_CONFIG_LOG(AZ_ULOG_TYPE_ERROR, AZ_ULOG_REQUIRE_NOT_NULL_STRING, MU_TOSTRING(val)); \ 177 AZ_ULIB_PORT_THROW_HARD_FAULT; \ Small footprint logging functionality.
Configuration options for ulib.