1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Fix GCC complaining about null parameter to vsnprintf (#24903)

This commit is contained in:
Michał Janiszewski
2025-08-06 11:59:17 +02:00
committed by GitHub
parent 8efb075201
commit 8ef4b207b9

View File

@@ -338,7 +338,15 @@ namespace OpenRCT2::String
// null terminator. // null terminator.
va_list copy; va_list copy;
va_copy(copy, args); va_copy(copy, args);
#pragma GCC diagnostic push
// clang does not recognize -Wformat-truncation and errors on -Wunknown-warning-option.
// GCC does not recognize disabling -Wunknown-warning-option via pragma
// Only disable this warning for GCC, as Clang does not support it.
#ifndef __clang__
#pragma GCC diagnostic ignored "-Wformat-truncation"
#endif
auto len = vsnprintf(nullptr, 0, format, copy); auto len = vsnprintf(nullptr, 0, format, copy);
#pragma GCC diagnostic pop
va_end(copy); va_end(copy);
if (len >= 0) if (len >= 0)