Introduce null_block_symbol

... in the spirit of null_ptid, null_frame_id, etc.

Fixes two instances of:

  /root/binutils-gdb/gdb/cp-namespace.c: In function 'block_symbol cp_lookup_nested_symbol(type*, const char*, const block*, domain_enum)':
  /root/binutils-gdb/gdb/cp-namespace.c:1010: warning: jump to case label
  /root/binutils-gdb/gdb/cp-namespace.c:1008: error:   crosses initialization of 'block_symbol <anonymous>'

Compiler info:

  Reading specs from /usr/lib/gcc-lib/amd64-unknown-openbsd5.8/4.2.1/specs
  Target: amd64-unknown-openbsd5.8
  Configured with: OpenBSD/amd64 system compiler
  Thread model: posix
  gcc version 4.2.1 20070719

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

	* cp-namespace.c (cp_lookup_bare_symbol)
	(cp_search_static_and_baseclasses, cp_lookup_symbol_via_imports)
	(cp_lookup_symbol_via_all_imports, cp_lookup_nested_symbol_1)
	(cp_lookup_nested_symbol): Use null_block_symbol.
	* d-namespace.c (d_lookup_symbol, d_lookup_nested_symbol)
	(d_lookup_symbol_imports, d_lookup_symbol_module): Use
	null_block_symbol.
	* symtab.c (null_block_symbol): New global.
	* symtab.h (null_block_symbol): Declare.
This commit is contained in:
Pedro Alves
2015-11-17 13:12:23 +00:00
parent eec461d0a8
commit b6b806729d
5 changed files with 31 additions and 12 deletions

View File

@@ -132,7 +132,7 @@ d_lookup_symbol (const struct language_defn *langdef,
if (lang_this.symbol == NULL)
{
do_cleanups (cleanup);
return (struct block_symbol) {NULL, NULL};
return null_block_symbol;
}
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
@@ -159,7 +159,7 @@ d_lookup_symbol (const struct language_defn *langdef,
if (class_sym.symbol == NULL)
{
do_cleanups (cleanup);
return (struct block_symbol) {NULL, NULL};
return null_block_symbol;
}
/* Look for a symbol named NESTED in this class. */
@@ -370,7 +370,7 @@ d_lookup_nested_symbol (struct type *parent_type,
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
return (struct block_symbol) {NULL, NULL};
return null_block_symbol;
default:
gdb_assert_not_reached ("called with non-aggregate type.");
@@ -530,7 +530,7 @@ d_lookup_symbol_imports (const char *scope, const char *name,
}
}
return (struct block_symbol) {NULL, NULL};
return null_block_symbol;
}
/* Searches for NAME in the current module, and by applying relevant
@@ -562,7 +562,7 @@ d_lookup_symbol_module (const char *scope, const char *name,
block = BLOCK_SUPERBLOCK (block);
}
return (struct block_symbol) {NULL, NULL};
return null_block_symbol;
}
/* The D-specific version of name lookup for static and global names