summaryrefslogtreecommitdiff
path: root/core/os/memory.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-10-04 13:04:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2018-10-04 13:08:41 +0200
commitf48ee838e7b88a630f9dea76b697eb4626d69abc (patch)
tree83d392f8e6e0773b80059ea6d9b865fed5cb8020 /core/os/memory.cpp
parent156c4eab022a52ff2415cd4b2dd3a3b2034c18d1 (diff)
Fix GCC 8 warnings about potentially unitialized variables
Fixes the following GCC 8 warnings: ``` core/image.cpp:730:44: warning: 'mip1_weight' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:293:20: warning: 'mip2' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:293:20: warning: 'mip1' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/audio_stream_preview.cpp:58:19: warning: 'vmax' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/audio_stream_preview.cpp:85:19: warning: 'vmin' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/editor_themes.cpp:306:53: warning: 'preset_contrast' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/plugins/animation_blend_space_2d_editor.cpp:459:27: warning: 'prev_idx' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/plugins/animation_blend_space_2d_editor.cpp:443:27: warning: 'prev_idx' may be used uninitialized in this function [-Wmaybe-uninitialized] main/tests/test_oa_hash_map.cpp:57:29: warning: 'value' may be used uninitialized in this function [-Wmaybe-uninitialized] modules/csg/csg.cpp:764:40: warning: 'max_angle' may be used uninitialized in this function [-Wmaybe-uninitialized] modules/csg/csg_shape.cpp:1945:3: warning: 'face_count' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/3d/voxel_light_baker.cpp:1593:8: warning: 'cone_aperture' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/3d/voxel_light_baker.cpp:1592:6: warning: 'cone_dir_count' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/animation/animation_blend_space_2d.cpp:471:8: warning: 'mind' may be used uninitialized in this function [-Wmaybe-uninitialized] core/os/memory.cpp:94: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] core/os/memory.cpp:95: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] core/os/memory.cpp:98: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ```
Diffstat (limited to 'core/os/memory.cpp')
-rw-r--r--core/os/memory.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index be48c927b6..d212efe3cf 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -91,11 +91,15 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
if (prepad) {
// Clang 5 wrongly complains about 's' being unused,
// while it's used to modify 'mem'.
+#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
+#endif // __clang__
uint64_t *s = (uint64_t *)mem;
*s = p_bytes;
+#ifdef __clang__
#pragma clang diagnostic pop
+#endif // __clang__
uint8_t *s8 = (uint8_t *)mem;