diff --git a/antithesis_sdk.h b/antithesis_sdk.h index 14eb292..fb44205 100644 --- a/antithesis_sdk.h +++ b/antithesis_sdk.h @@ -767,6 +767,8 @@ namespace antithesis::internal::assertions { namespace antithesis::internal { namespace { // Anonymous namespace which is translation-unit-specific; certain symbols aren't exposed in the symbol table as a result + enum msg_name_e { msg_name }; + template struct fixed_string { std::array contents; @@ -776,11 +778,20 @@ namespace { // Anonymous namespace which is translation-unit-specific; certain s #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" + constexpr fixed_string( const char (&arr)[N] ) { for(unsigned int i=0; i from_c_str( const char* s ) { fixed_string it; for(unsigned int i=0; i fixed_string( const char (&arr)[N] ) -> fixed_string; + template + fixed_string( const char (&arr)[N], msg_name_e ) -> fixed_string; + #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" static constexpr size_t string_length( const char * s ) { @@ -935,7 +949,7 @@ namespace { // Anonymous namespace which is translation-unit-specific; certain s #define ANTITHESIS_ASSERT_RAW(type, cond, message, ...) ( \ antithesis::internal::CatalogEntry< \ type, \ - antithesis::internal::fixed_string(message), \ + antithesis::internal::fixed_string(message, antithesis::internal::msg_name), \ FIXED_STRING_FROM_C_STR(std::source_location::current().file_name()), \ FIXED_STRING_FROM_C_STR(std::source_location::current().function_name()), \ std::source_location::current().line(), \ @@ -955,7 +969,7 @@ do { \ antithesis::internal::NumericGuidanceCatalogEntry< \ decltype(left), \ guidepost_type, \ - antithesis::internal::fixed_string(message), \ + antithesis::internal::fixed_string(message, antithesis::internal::msg_name), \ FIXED_STRING_FROM_C_STR(std::source_location::current().file_name()), \ FIXED_STRING_FROM_C_STR(std::source_location::current().function_name()), \ std::source_location::current().line(), \ @@ -995,7 +1009,7 @@ do { \ antithesis::internal::BooleanGuidanceCatalogEntry< \ decltype(json_pairs), \ antithesis::internal::assertions::GUIDEPOST_NONE, \ - antithesis::internal::fixed_string(message), \ + antithesis::internal::fixed_string(message, antithesis::internal::msg_name), \ FIXED_STRING_FROM_C_STR(std::source_location::current().file_name()), \ FIXED_STRING_FROM_C_STR(std::source_location::current().function_name()), \ std::source_location::current().line(), \ @@ -1018,7 +1032,7 @@ do { \ antithesis::internal::BooleanGuidanceCatalogEntry< \ decltype(json_pairs), \ antithesis::internal::assertions::GUIDEPOST_ALL, \ - antithesis::internal::fixed_string(message), \ + antithesis::internal::fixed_string(message, antithesis::internal::msg_name), \ FIXED_STRING_FROM_C_STR(std::source_location::current().file_name()), \ FIXED_STRING_FROM_C_STR(std::source_location::current().function_name()), \ std::source_location::current().line(), \