mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 01:22:25 +01:00
Fix GCC complaining about null parameter to vsnprintf (#24903)
This commit is contained in:
committed by
GitHub
parent
8efb075201
commit
8ef4b207b9
@@ -338,7 +338,15 @@ namespace OpenRCT2::String
|
||||
// null terminator.
|
||||
va_list copy;
|
||||
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);
|
||||
#pragma GCC diagnostic pop
|
||||
va_end(copy);
|
||||
|
||||
if (len >= 0)
|
||||
|
||||
Reference in New Issue
Block a user