Skip to content

Commit 7683ef7

Browse files
Repiteoakien-mga
andcommitted
Core: Sidestep GCC false-positives
(cherry picked from commit acdb866) Adds some more fixes for 4.5. Co-authored-by: Rémi Verschelde <[email protected]>
1 parent 1a1be13 commit 7683ef7

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

core/io/image.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,6 +2331,10 @@ void Image::initialize_data(const char **p_xpm) {
23312331
} break;
23322332
case READING_PIXELS: {
23332333
int y = line - colormap_size - 1;
2334+
#if defined(__GNUC__) && !defined(__clang__)
2335+
#pragma GCC diagnostic push
2336+
#pragma GCC diagnostic warning "-Wstringop-overflow=0"
2337+
#endif
23342338
for (int x = 0; x < size_width; x++) {
23352339
char pixelstr[6] = { 0, 0, 0, 0, 0, 0 };
23362340
for (int i = 0; i < pixelchars; i++) {
@@ -2345,6 +2349,9 @@ void Image::initialize_data(const char **p_xpm) {
23452349
}
23462350
_put_pixelb(x, y, pixel_size, data_write, pixel);
23472351
}
2352+
#if defined(__GNUC__) && !defined(__clang__)
2353+
#pragma GCC diagnostic pop
2354+
#endif
23482355

23492356
if (y == (size_height - 1)) {
23502357
status = DONE;

core/math/geometry_2d.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030

3131
#include "geometry_2d.h"
3232

33+
#if defined(__GNUC__) && !defined(__clang__)
34+
#pragma GCC diagnostic push
35+
#pragma GCC diagnostic ignored "-Walloc-zero"
36+
#endif
3337
#include "thirdparty/clipper2/include/clipper2/clipper.h"
38+
#if defined(__GNUC__) && !defined(__clang__)
39+
#pragma GCC diagnostic pop
40+
#endif
3441
#include "thirdparty/misc/polypartition.h"
3542
#define STB_RECT_PACK_IMPLEMENTATION
3643
#include "thirdparty/misc/stb_rect_pack.h"

scene/resources/packed_scene.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
158158
const NodeData *nd = &nodes[0];
159159

160160
Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc);
161+
ret_nodes[0] = nullptr; // Sidesteps "maybe uninitialized" false-positives on GCC.
161162

162163
bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty();
163164

0 commit comments

Comments
 (0)