浏览代码

Fix maybe-uninitialized warnings from GCC 4.8.x

Fixes the following warnings in `p=server target=release_debug` builds
on Travis CI:
```
./core/os/memory.h: In function 'MainLoop* TestOAHashMap::test()':
./core/os/memory.h:108:111: warning: 'dummy' may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define memnew_placement(m_placement, m_class) _post_initialize(new (m_placement, sizeof(m_class), "") m_class)
                                                                                                               ^
main/tests/test_oa_hash_map.cpp:98:7: note: 'dummy' was declared here
   int dummy;
       ^

scene/resources/bit_mask.cpp:447:3: warning: 'next_i' may be used uninitialized in this function [-Wmaybe-uninitialized]
scene/resources/bit_mask.cpp:448:4: warning: 'next_j' may be used uninitialized in this function [-Wmaybe-uninitialized]
```
Rémi Verschelde 6 年之前
父节点
当前提交
4d546164e7
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      main/tests/test_oa_hash_map.cpp
  2. 2 2
      scene/resources/bit_mask.cpp

+ 1 - 1
main/tests/test_oa_hash_map.cpp

@@ -95,7 +95,7 @@ MainLoop *test() {
 	// stress test / test for issue #22928
 	// stress test / test for issue #22928
 	{
 	{
 		OAHashMap<int, int> map;
 		OAHashMap<int, int> map;
-		int dummy;
+		int dummy = 0;
 		const int N = 1000;
 		const int N = 1000;
 		uint32_t *keys = new uint32_t[N];
 		uint32_t *keys = new uint32_t[N];
 
 

+ 2 - 2
scene/resources/bit_mask.cpp

@@ -432,8 +432,8 @@ static void fill_bits(const BitMap *p_src, Ref<BitMap> &p_map, const Point2i &p_
 	int stack_size = 0;
 	int stack_size = 0;
 
 
 	Point2i pos = p_pos;
 	Point2i pos = p_pos;
-	int next_i;
-	int next_j;
+	int next_i = 0;
+	int next_j = 0;
 
 
 	bool reenter = true;
 	bool reenter = true;
 	bool popped = false;
 	bool popped = false;