You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Core: Sidestep GCC false-positive warnings
(cherry picked from commitsacdb8667b5and6733345f73) Adds some more fixes for 4.5. Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com> Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
This commit is contained in:
committed by
Rémi Verschelde
parent
8351a28101
commit
20c59d6924
@@ -5855,6 +5855,15 @@ String String::unquote() const {
|
||||
return substr(1, length() - 2);
|
||||
}
|
||||
|
||||
// MinGW-GCC false positives because CharStringT::length() is int (so possibly < 0).
|
||||
// Don't silence for regular GCC/Clang as this is code that _could_ exhibit actual overflow bugs.
|
||||
#ifdef __MINGW32__
|
||||
GODOT_GCC_WARNING_PUSH
|
||||
GODOT_GCC_PRAGMA(GCC diagnostic warning "-Wstringop-overflow=0")
|
||||
GODOT_GCC_WARNING_IGNORE("-Warray-bounds")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wrestrict")
|
||||
#endif
|
||||
|
||||
Vector<uint8_t> String::to_ascii_buffer() const {
|
||||
const String *s = this;
|
||||
if (s->is_empty()) {
|
||||
@@ -5903,6 +5912,10 @@ Vector<uint8_t> String::to_utf16_buffer() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
GODOT_GCC_WARNING_POP
|
||||
#endif
|
||||
|
||||
Vector<uint8_t> String::to_utf32_buffer() const {
|
||||
const String *s = this;
|
||||
if (s->is_empty()) {
|
||||
|
||||
Reference in New Issue
Block a user