Fix build error due to uninitialized variable warning
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 3 Aug 2015 12:35:58 +0000 (14:35 +0200)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 3 Aug 2015 12:35:58 +0000 (14:35 +0200)
As of commit a5fdf78a4402341a0ae23a5ca8a63825e2b5286c, building GDB with
a GCC 4.1 host compiler fails with:

gdb/cp-namespace.c: In function 'cp_lookup_symbol_via_imports':
gdb/cp-namespace.c:482: warning: 'sym.block' may be used uninitialized in this function

Apparently, more recent compilers are able to deduce that no actual
uninitialized use of sym.block takes place, but GCC 4.1 isn't yet
able to do that.

Fixed by adding an explicit initalization.

gdb/
* cp-namespace.c (cp_lookup_symbol_via_imports): Fix uninitialized
variable warning with some compilers.

gdb/ChangeLog
gdb/cp-namespace.c

index 817610ec1580695ec03b2e79b68f6a29431f4f49..9d9761a3139f7f646fbf6e423fd73646aee4b7fe 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-03  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * cp-namespace.c (cp_lookup_symbol_via_imports): Fix uninitialized
+       variable warning with some compilers.
+
 2015-08-03  Yao Qi  <yao.qi@linaro.org>
 
        * arm-linux-nat.c (arm_linux_get_hwbp_type): Capitalize "type"
index aa29c920e11581a3ee05c0a3437402f95e398d7b..f5f4bad878de10f3ea43ccbdacb719255c3ebce4 100644 (file)
@@ -485,6 +485,7 @@ cp_lookup_symbol_via_imports (const char *scope,
   struct cleanup *searched_cleanup;
 
   sym.symbol = NULL;
+  sym.block = NULL;
 
   /* First, try to find the symbol in the given namespace if requested.  */
   if (search_scope_first)