Merge pull request #112134 from akien-mga/4.1-fix-gcc-warnings

[4.1] CI: Fix build with latest MinGW-GCC 15
This commit is contained in:
Rémi Verschelde 2025-10-28 23:05:12 +01:00 committed by GitHub
commit 8188bc7118
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 53 additions and 13 deletions

View file

@ -2338,6 +2338,10 @@ void Image::initialize_data(const char **p_xpm) {
} break; } break;
case READING_PIXELS: { case READING_PIXELS: {
int y = line - colormap_size - 1; int y = line - colormap_size - 1;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wstringop-overflow=0"
#endif
for (int x = 0; x < size_width; x++) { for (int x = 0; x < size_width; x++) {
char pixelstr[6] = { 0, 0, 0, 0, 0, 0 }; char pixelstr[6] = { 0, 0, 0, 0, 0, 0 };
for (int i = 0; i < pixelchars; i++) { for (int i = 0; i < pixelchars; i++) {
@ -2352,6 +2356,9 @@ void Image::initialize_data(const char **p_xpm) {
} }
_put_pixelb(x, y, pixel_size, data_write, pixel); _put_pixelb(x, y, pixel_size, data_write, pixel);
} }
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
if (y == (size_height - 1)) { if (y == (size_height - 1)) {
status = DONE; status = DONE;

View file

@ -1453,7 +1453,7 @@ void TextureStorage::update_texture_atlas() {
//generate atlas //generate atlas
Vector<TextureAtlas::SortItem> itemsv; Vector<TextureAtlas::SortItem> itemsv;
itemsv.resize(texture_atlas.textures.size()); itemsv.resize(texture_atlas.textures.size());
int base_size = 8; uint32_t base_size = 8;
int idx = 0; int idx = 0;
@ -1466,7 +1466,7 @@ void TextureStorage::update_texture_atlas() {
si.size.height = (src_tex->height / border) + 1; si.size.height = (src_tex->height / border) + 1;
si.pixel_size = Size2i(src_tex->width, src_tex->height); si.pixel_size = Size2i(src_tex->width, src_tex->height);
if (base_size < si.size.width) { if (base_size < (uint32_t)si.size.width) {
base_size = nearest_power_of_2_templated(si.size.width); base_size = nearest_power_of_2_templated(si.size.width);
} }
@ -1497,7 +1497,7 @@ void TextureStorage::update_texture_atlas() {
TextureAtlas::SortItem &si = items[i]; TextureAtlas::SortItem &si = items[i];
int best_idx = -1; int best_idx = -1;
int best_height = 0x7FFFFFFF; int best_height = 0x7FFFFFFF;
for (int j = 0; j <= base_size - si.size.width; j++) { for (uint32_t j = 0; j <= base_size - si.size.width; j++) {
int height = 0; int height = 0;
for (int k = 0; k < si.size.width; k++) { for (int k = 0; k < si.size.width; k++) {
int h = v_offsets[k + j]; int h = v_offsets[k + j];
@ -1528,7 +1528,7 @@ void TextureStorage::update_texture_atlas() {
} }
} }
if (max_height <= base_size * 2) { if ((uint32_t)max_height <= base_size * 2) {
atlas_height = max_height; atlas_height = max_height;
break; //good ratio, break; break; //good ratio, break;
} }

View file

@ -89,7 +89,7 @@ __CRT_UUID_DECL(IAudioClient3, 0x7ED4EE07, 0x8E67, 0x4CD4, 0x8C, 0x1A, 0x2B, 0x7
#endif // __MINGW32__ || __MINGW64__ #endif // __MINGW32__ || __MINGW64__
#ifndef PKEY_Device_FriendlyName #ifndef PKEY_Device_FriendlyNameGodot
#undef DEFINE_PROPERTYKEY #undef DEFINE_PROPERTYKEY
/* clang-format off */ /* clang-format off */
@ -97,7 +97,7 @@ __CRT_UUID_DECL(IAudioClient3, 0x7ED4EE07, 0x8E67, 0x4CD4, 0x8C, 0x1A, 0x2B, 0x7
const PROPERTYKEY id = { { a, b, c, { d, e, f, g, h, i, j, k, } }, l }; const PROPERTYKEY id = { { a, b, c, { d, e, f, g, h, i, j, k, } }, l };
/* clang-format on */ /* clang-format on */
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); DEFINE_PROPERTYKEY(PKEY_Device_FriendlyNameGodot, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
#endif #endif
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator); const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
@ -237,7 +237,7 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_i
PROPVARIANT propvar; PROPVARIANT propvar;
PropVariantInit(&propvar); PropVariantInit(&propvar);
hr = props->GetValue(PKEY_Device_FriendlyName, &propvar); hr = props->GetValue(PKEY_Device_FriendlyNameGodot, &propvar);
ERR_BREAK(hr != S_OK); ERR_BREAK(hr != S_OK);
if (p_device->device_name == String(propvar.pwszVal)) { if (p_device->device_name == String(propvar.pwszVal)) {
@ -609,7 +609,7 @@ PackedStringArray AudioDriverWASAPI::audio_device_get_list(bool p_input) {
PROPVARIANT propvar; PROPVARIANT propvar;
PropVariantInit(&propvar); PropVariantInit(&propvar);
hr = props->GetValue(PKEY_Device_FriendlyName, &propvar); hr = props->GetValue(PKEY_Device_FriendlyNameGodot, &propvar);
ERR_BREAK(hr != S_OK); ERR_BREAK(hr != S_OK);
list.push_back(String(propvar.pwszVal)); list.push_back(String(propvar.pwszVal));

View file

@ -108,6 +108,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
const NodeData *nd = &nodes[0]; const NodeData *nd = &nodes[0];
Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc); Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc);
ret_nodes[0] = nullptr; // Sidesteps "maybe uninitialized" false-positives on GCC.
bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty(); bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty();

View file

@ -2101,7 +2101,7 @@ void TextureStorage::update_decal_atlas() {
//generate atlas //generate atlas
Vector<DecalAtlas::SortItem> itemsv; Vector<DecalAtlas::SortItem> itemsv;
itemsv.resize(decal_atlas.textures.size()); itemsv.resize(decal_atlas.textures.size());
int base_size = 8; uint32_t base_size = 8;
int idx = 0; int idx = 0;
@ -2114,7 +2114,7 @@ void TextureStorage::update_decal_atlas() {
si.size.height = (src_tex->height / border) + 1; si.size.height = (src_tex->height / border) + 1;
si.pixel_size = Size2i(src_tex->width, src_tex->height); si.pixel_size = Size2i(src_tex->width, src_tex->height);
if (base_size < si.size.width) { if (base_size < (uint32_t)si.size.width) {
base_size = nearest_power_of_2_templated(si.size.width); base_size = nearest_power_of_2_templated(si.size.width);
} }
@ -2145,7 +2145,7 @@ void TextureStorage::update_decal_atlas() {
DecalAtlas::SortItem &si = items[i]; DecalAtlas::SortItem &si = items[i];
int best_idx = -1; int best_idx = -1;
int best_height = 0x7FFFFFFF; int best_height = 0x7FFFFFFF;
for (int j = 0; j <= base_size - si.size.width; j++) { for (uint32_t j = 0; j <= base_size - si.size.width; j++) {
int height = 0; int height = 0;
for (int k = 0; k < si.size.width; k++) { for (int k = 0; k < si.size.width; k++) {
int h = v_offsets[k + j]; int h = v_offsets[k + j];
@ -2176,7 +2176,7 @@ void TextureStorage::update_decal_atlas() {
} }
} }
if (max_height <= base_size * 2) { if ((uint32_t)max_height <= base_size * 2) {
atlas_height = max_height; atlas_height = max_height;
break; //good ratio, break; break; //good ratio, break;
} }

View file

@ -20,7 +20,7 @@ extern "C" {
#define vulkan_video_codec_h264std 1 #define vulkan_video_codec_h264std 1
#include <stdint.h> #include "vulkan_video_codecs_common.h"
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32 #define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6 #define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16 #define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16

View file

@ -20,6 +20,10 @@ extern "C" {
#define vulkan_video_codecs_common 1 #define vulkan_video_codecs_common 1
#if !defined(VK_NO_STDINT_H)
#include <stdint.h>
#endif
#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))

View file

@ -0,0 +1,28 @@
diff --git a/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h b/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h
index 21c7b667fd..089f30912c 100644
--- a/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h
+++ b/thirdparty/vulkan/include/vk_video/vulkan_video_codec_h264std.h
@@ -20,7 +20,7 @@ extern "C" {
#define vulkan_video_codec_h264std 1
-#include <stdint.h>
+#include "vulkan_video_codecs_common.h"
#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
diff --git a/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h b/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h
index f486d3ca3f..43bfcd09ad 100644
--- a/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h
+++ b/thirdparty/vulkan/include/vk_video/vulkan_video_codecs_common.h
@@ -20,6 +20,10 @@ extern "C" {
#define vulkan_video_codecs_common 1
+#if !defined(VK_NO_STDINT_H)
+ #include <stdint.h>
+#endif
+
#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))