This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 09/18] poison "namespace"
- From: Ondrej Oprala <ooprala at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Mon, 21 Oct 2013 17:37:17 +0200
- Subject: [PATCH 09/18] poison "namespace"
- Authentication-results: sourceware.org; auth=none
- References: <1382369846-5817-1-git-send-email-ooprala at redhat dot com>
From: Tom Tromey <tromey@redhat.com>
gdb/ChangeLog
2013-10-21 Tom Tromey <tromey@redhat.com>
* ada-lang.c (domain): Renamed from namespace.
* ada-lang.h (domain): Likewise.
* block.h (namespace_info): Likewise.
* common/filestuff.c (socket_namespace): Likewise.
* common/filestuff.h (socket_namespace): Likewise.
* cp-namespace.c (name_space): Likewise.
* cp-support.c (name_space): Likewise.
* cp-support.h (name_space): Likewise.
* dwarf2read.c (domain): Likewise.
* psymtab.c (domain): Likewise.
* symfile.h (domain): Likewise.
---
gdb/ada-lang.c | 30 +++++++++++++++---------------
gdb/ada-lang.h | 2 +-
gdb/block.h | 5 +++--
gdb/common/filestuff.c | 10 ++++++----
gdb/common/filestuff.h | 5 +++--
gdb/cp-namespace.c | 30 +++++++++++++++---------------
gdb/cp-support.c | 38 +++++++++++++++++++-------------------
gdb/cp-support.h | 4 ++--
gdb/dwarf2read.c | 2 +-
gdb/psymtab.c | 10 +++++-----
gdb/symfile.h | 6 +++---
11 files changed, 73 insertions(+), 69 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9ff3ab9..69e2d2b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4223,14 +4223,14 @@ make_array_descriptor (struct type *type, struct value *arr)
* used in the public sources. */
static int
-lookup_cached_symbol (const char *name, domain_enum namespace,
+lookup_cached_symbol (const char *name, domain_enum domain,
struct symbol **sym, struct block **block)
{
return 0;
}
static void
-cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
+cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
const struct block *block)
{
}
@@ -4453,7 +4453,7 @@ ada_lookup_simple_minsym (const char *name)
static void
add_symbols_from_enclosing_procs (struct obstack *obstackp,
- const char *name, domain_enum namespace,
+ const char *name, domain_enum domain,
int wild_match_p)
{
}
@@ -5132,7 +5132,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
static int
ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
- domain_enum namespace,
+ domain_enum domain,
struct ada_symbol_info **results,
int full_search)
{
@@ -5175,7 +5175,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
if (full_search)
{
ada_add_local_symbols (&symbol_list_obstack, name, block,
- namespace, wild_match_p);
+ domain, wild_match_p);
}
else
{
@@ -5183,7 +5183,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
ada_iterate_over_symbols, and we don't want to search
superblocks. */
ada_add_block_symbols (&symbol_list_obstack, block, name,
- namespace, NULL, wild_match_p);
+ domain, NULL, wild_match_p);
}
if (num_defns_collected (&symbol_list_obstack) > 0 || !full_search)
goto done;
@@ -5194,7 +5194,7 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
the same result. */
cacheIfUnique = 1;
- if (lookup_cached_symbol (name0, namespace, &sym, &block))
+ if (lookup_cached_symbol (name0, domain, &sym, &block))
{
if (sym != NULL)
add_defn_to_vec (&symbol_list_obstack, sym, block);
@@ -5203,14 +5203,14 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
/* Search symbols from all global blocks. */
- add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 1,
+ add_nonlocal_symbols (&symbol_list_obstack, name, domain, 1,
wild_match_p);
/* Now add symbols from all per-file blocks if we've gotten no hits
(not strictly correct, but perhaps better than an error). */
if (num_defns_collected (&symbol_list_obstack) == 0)
- add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 0,
+ add_nonlocal_symbols (&symbol_list_obstack, name, domain, 0,
wild_match_p);
done:
@@ -5220,10 +5220,10 @@ done:
ndefns = remove_extra_symbols (*results, ndefns);
if (ndefns == 0 && full_search)
- cache_symbol (name0, namespace, NULL, NULL);
+ cache_symbol (name0, domain, NULL, NULL);
if (ndefns == 1 && full_search && cacheIfUnique)
- cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block);
+ cache_symbol (name0, domain, (*results)[0].sym, (*results)[0].block);
ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
@@ -5295,7 +5295,7 @@ ada_name_for_lookup (const char *name)
void
ada_lookup_encoded_symbol (const char *name, const struct block *block,
- domain_enum namespace,
+ domain_enum domain,
struct ada_symbol_info *info)
{
struct ada_symbol_info *candidates;
@@ -5304,7 +5304,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
gdb_assert (info != NULL);
memset (info, 0, sizeof (struct ada_symbol_info));
- n_candidates = ada_lookup_symbol_list (name, block, namespace, &candidates);
+ n_candidates = ada_lookup_symbol_list (name, block, domain, &candidates);
if (n_candidates == 0)
return;
@@ -5320,7 +5320,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
struct symbol *
ada_lookup_symbol (const char *name, const struct block *block0,
- domain_enum namespace, int *is_a_field_of_this)
+ domain_enum domain, int *is_a_field_of_this)
{
struct ada_symbol_info info;
@@ -5328,7 +5328,7 @@ ada_lookup_symbol (const char *name, const struct block *block0,
*is_a_field_of_this = 0;
ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
- block0, namespace, &info);
+ block0, domain, &info);
return info.sym;
}
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 151ced8..10212d1 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -246,7 +246,7 @@ extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
domain_enum, int *);
extern void ada_lookup_encoded_symbol
- (const char *name, const struct block *block, domain_enum namespace,
+ (const char *name, const struct block *block, domain_enum domain,
struct ada_symbol_info *symbol_info);
extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
diff --git a/gdb/block.h b/gdb/block.h
index 02e7e8b..6563b42 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -92,7 +92,7 @@ struct block
this block: using directives and the current namespace
scope. */
- struct block_namespace_info *namespace;
+ struct block_namespace_info *namespace_info;
}
cplus_specific;
}
@@ -119,7 +119,8 @@ struct global_block
#define BLOCK_FUNCTION(bl) (bl)->function
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
#define BLOCK_DICT(bl) (bl)->dict
-#define BLOCK_NAMESPACE(bl) (bl)->language_specific.cplus_specific.namespace
+#define BLOCK_NAMESPACE(bl) \
+ (bl)->language_specific.cplus_specific.namespace_info
struct blockvector
{
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index 4032f36..7f35b62 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -350,10 +350,12 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
/* See filestuff.h. */
int
-gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
+gdb_socketpair_cloexec (int socket_namespace,
+ int style, int protocol, int filedes[2])
{
#ifdef HAVE_SOCKETPAIR
- int result = socketpair (namespace, style | SOCK_CLOEXEC, protocol, filedes);
+ int result = socketpair (socket_namespace,
+ style | SOCK_CLOEXEC, protocol, filedes);
if (result != -1)
{
@@ -370,9 +372,9 @@ gdb_socketpair_cloexec (int namespace, int style, int protocol, int filedes[2])
/* See filestuff.h. */
int
-gdb_socket_cloexec (int namespace, int style, int protocol)
+gdb_socket_cloexec (int socket_namespace, int style, int protocol)
{
- int result = socket (namespace, style | SOCK_CLOEXEC, protocol);
+ int result = socket (socket_namespace, style | SOCK_CLOEXEC, protocol);
if (result != -1)
socket_mark_cloexec (result);
diff --git a/gdb/common/filestuff.h b/gdb/common/filestuff.h
index b162a0c..91062a7 100644
--- a/gdb/common/filestuff.h
+++ b/gdb/common/filestuff.h
@@ -54,13 +54,14 @@ extern FILE *gdb_fopen_cloexec (const char *filename, const char *opentype);
/* Like 'socketpair', but ensures that the returned file descriptors
have the close-on-exec flag set. */
-extern int gdb_socketpair_cloexec (int namespace, int style, int protocol,
+extern int gdb_socketpair_cloexec (int socket_namespace,
+ int style, int protocol,
int filedes[2]);
/* Like 'socket', but ensures that the returned file descriptor has
the close-on-exec flag set. */
-extern int gdb_socket_cloexec (int namespace, int style, int protocol);
+extern int gdb_socket_cloexec (int socket_namespace, int style, int protocol);
/* Like 'pipe', but ensures that the returned file descriptors have
the close-on-exec flag set. */
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index bc5ea10..caad3a1 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -210,9 +210,9 @@ cp_add_using_directive (const char *dest,
namespace; return nonzero if so. */
int
-cp_is_anonymous (const char *namespace)
+cp_is_anonymous (const char *name_space)
{
- return (strstr (namespace, CP_ANONYMOUS_NAMESPACE_STR)
+ return (strstr (name_space, CP_ANONYMOUS_NAMESPACE_STR)
!= NULL);
}
@@ -241,30 +241,30 @@ cp_lookup_symbol_nonlocal (const char *name,
block, domain);
}
-/* Look up NAME in the C++ namespace NAMESPACE. Other arguments are
+/* Look up NAME in the C++ namespace NAME_SPACE. Other arguments are
as in cp_lookup_symbol_nonlocal. If SEARCH is non-zero, search
through base classes for a matching symbol. */
static struct symbol *
-cp_lookup_symbol_in_namespace (const char *namespace,
+cp_lookup_symbol_in_namespace (const char *name_space,
const char *name,
const struct block *block,
const domain_enum domain, int search)
{
- if (namespace[0] == '\0')
+ if (name_space[0] == '\0')
{
return lookup_symbol_file (name, block, domain, 0, search);
}
else
{
- char *concatenated_name = alloca (strlen (namespace) + 2
+ char *concatenated_name = alloca (strlen (name_space) + 2
+ strlen (name) + 1);
- strcpy (concatenated_name, namespace);
+ strcpy (concatenated_name, name_space);
strcat (concatenated_name, "::");
strcat (concatenated_name, name);
return lookup_symbol_file (concatenated_name, block, domain,
- cp_is_anonymous (namespace), search);
+ cp_is_anonymous (name_space), search);
}
}
@@ -357,7 +357,7 @@ cp_lookup_symbol_imports (const char *scope,
/* If there is an import of a single declaration, compare the
imported declaration (after optional renaming by its alias)
with the sought out name. If there is a match pass
- current->import_src as NAMESPACE to direct the search
+ current->import_src as NAME_SPACE to direct the search
towards the imported namespace. */
if (current->declaration
&& strcmp (name, current->alias
@@ -403,7 +403,7 @@ cp_lookup_symbol_imports (const char *scope,
else if (current->alias == NULL)
{
/* If this import statement creates no alias, pass
- current->inner as NAMESPACE to direct the search
+ current->inner as NAME_SPACE to direct the search
towards the imported namespace. */
sym = cp_lookup_symbol_imports (current->import_src,
name, block,
@@ -571,7 +571,7 @@ lookup_namespace_scope (const char *name,
const char *scope,
int scope_len)
{
- char *namespace;
+ char *name_space;
if (scope[scope_len] != '\0')
{
@@ -596,10 +596,10 @@ lookup_namespace_scope (const char *name,
/* Okay, we didn't find a match in our children, so look for the
name in the current namespace. */
- namespace = alloca (scope_len + 1);
- strncpy (namespace, scope, scope_len);
- namespace[scope_len] = '\0';
- return cp_lookup_symbol_in_namespace (namespace, name,
+ name_space = alloca (scope_len + 1);
+ strncpy (name_space, scope, scope_len);
+ name_space[scope_len] = '\0';
+ return cp_lookup_symbol_in_namespace (name_space, name,
block, domain, 1);
}
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 2042b93..4f8b048 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -58,7 +58,7 @@ static void overload_list_add_symbol (struct symbol *sym,
const char *oload_name);
static void make_symbol_overload_list_using (const char *func_name,
- const char *namespace);
+ const char *name_space);
static void make_symbol_overload_list_qualified (const char *func_name);
@@ -1168,7 +1168,7 @@ overload_list_add_symbol (struct symbol *sym,
struct symbol **
make_symbol_overload_list (const char *func_name,
- const char *namespace)
+ const char *name_space)
{
struct cleanup *old_cleanups;
const char *name;
@@ -1181,15 +1181,15 @@ make_symbol_overload_list (const char *func_name,
old_cleanups = make_cleanup (xfree, sym_return_val);
- make_symbol_overload_list_using (func_name, namespace);
+ make_symbol_overload_list_using (func_name, name_space);
- if (namespace[0] == '\0')
+ if (name_space[0] == '\0')
name = func_name;
else
{
char *concatenated_name
- = alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
- strcpy (concatenated_name, namespace);
+ = alloca (strlen (name_space) + 2 + strlen (func_name) + 1);
+ strcpy (concatenated_name, name_space);
strcat (concatenated_name, "::");
strcat (concatenated_name, func_name);
name = concatenated_name;
@@ -1218,23 +1218,23 @@ make_symbol_overload_list_block (const char *name,
overload_list_add_symbol (sym, name);
}
-/* Adds the function FUNC_NAME from NAMESPACE to the overload set. */
+/* Adds the function FUNC_NAME from NAME_SPACE to the overload set. */
static void
make_symbol_overload_list_namespace (const char *func_name,
- const char *namespace)
+ const char *name_space)
{
const char *name;
const struct block *block = NULL;
- if (namespace[0] == '\0')
+ if (name_space[0] == '\0')
name = func_name;
else
{
char *concatenated_name
- = alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
+ = alloca (strlen (name_space) + 2 + strlen (func_name) + 1);
- strcpy (concatenated_name, namespace);
+ strcpy (concatenated_name, name_space);
strcat (concatenated_name, "::");
strcat (concatenated_name, func_name);
name = concatenated_name;
@@ -1259,7 +1259,7 @@ static void
make_symbol_overload_list_adl_namespace (struct type *type,
const char *func_name)
{
- char *namespace;
+ char *name_space;
const char *type_name;
int i, prefix_len;
@@ -1283,11 +1283,11 @@ make_symbol_overload_list_adl_namespace (struct type *type,
if (prefix_len != 0)
{
- namespace = alloca (prefix_len + 1);
- strncpy (namespace, type_name, prefix_len);
- namespace[prefix_len] = '\0';
+ name_space = alloca (prefix_len + 1);
+ strncpy (name_space, type_name, prefix_len);
+ name_space[prefix_len] = '\0';
- make_symbol_overload_list_namespace (func_name, namespace);
+ make_symbol_overload_list_namespace (func_name, name_space);
}
/* Check public base type */
@@ -1336,7 +1336,7 @@ reset_directive_searched (void *data)
static void
make_symbol_overload_list_using (const char *func_name,
- const char *namespace)
+ const char *name_space)
{
struct using_direct *current;
const struct block *block;
@@ -1361,7 +1361,7 @@ make_symbol_overload_list_using (const char *func_name,
if (current->alias != NULL || current->declaration != NULL)
continue;
- if (strcmp (namespace, current->import_dest) == 0)
+ if (strcmp (name_space, current->import_dest) == 0)
{
/* Mark this import as searched so that the recursive call
does not search it again. */
@@ -1379,7 +1379,7 @@ make_symbol_overload_list_using (const char *func_name,
}
/* Now, add names for this namespace. */
- make_symbol_overload_list_namespace (func_name, namespace);
+ make_symbol_overload_list_namespace (func_name, name_space);
}
/* This does the bulk of the work of finding overloaded symbols.
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 0f2cebb..316f057 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -179,7 +179,7 @@ extern struct type *cp_lookup_rtti_type (const char *name,
/* Functions/variables from cp-namespace.c. */
-extern int cp_is_anonymous (const char *namespace);
+extern int cp_is_anonymous (const char *name_space);
extern void cp_add_using_directive (const char *dest,
const char *src,
@@ -196,7 +196,7 @@ extern struct symbol *cp_lookup_symbol_nonlocal (const char *name,
const struct block *block,
const domain_enum domain);
-extern struct symbol *cp_lookup_symbol_namespace (const char *namespace,
+extern struct symbol *cp_lookup_symbol_namespace (const char *name_space,
const char *name,
const struct block *block,
const domain_enum domain);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a563a6d..43cf150 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3735,7 +3735,7 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile,
static void
dw2_map_matching_symbols (struct objfile *objfile,
- const char * name, domain_enum namespace,
+ const char * name, domain_enum domain,
int global,
int (*callback) (struct block *,
struct symbol *, void *),
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index d9dc3e9..3109a42 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1212,7 +1212,7 @@ psymtab_to_fullname (struct partial_symtab *ps)
ever returns non-zero, and otherwise returns 0. */
static int
-map_block (const char *name, domain_enum namespace, struct objfile *objfile,
+map_block (const char *name, domain_enum domain, struct objfile *objfile,
struct block *block,
int (*callback) (struct block *, struct symbol *, void *),
void *data, symbol_compare_ftype *match)
@@ -1224,7 +1224,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
sym != NULL; sym = block_iter_match_next (name, match, &iter))
{
if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
- SYMBOL_DOMAIN (sym), namespace))
+ SYMBOL_DOMAIN (sym), domain))
{
if (callback (block, sym, data))
return 1;
@@ -1239,7 +1239,7 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile,
static void
map_matching_symbols_psymtab (struct objfile *objfile,
- const char *name, domain_enum namespace,
+ const char *name, domain_enum domain,
int global,
int (*callback) (struct block *,
struct symbol *, void *),
@@ -1254,7 +1254,7 @@ map_matching_symbols_psymtab (struct objfile *objfile,
{
QUIT;
if (ps->readin
- || match_partial_symbol (objfile, ps, global, name, namespace, match,
+ || match_partial_symbol (objfile, ps, global, name, domain, match,
ordered_compare))
{
struct symtab *s = psymtab_to_symtab (objfile, ps);
@@ -1263,7 +1263,7 @@ map_matching_symbols_psymtab (struct objfile *objfile,
if (s == NULL || !s->primary)
continue;
block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), block_kind);
- if (map_block (name, namespace, objfile, block,
+ if (map_block (name, domain, objfile, block,
callback, data, match))
return;
if (callback (block, NULL, data))
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 8e5909b..7c8881e 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -220,11 +220,11 @@ struct quick_symbol_functions
void (*expand_symtabs_with_fullname) (struct objfile *objfile,
const char *fullname);
- /* Find global or static symbols in all tables that are in NAMESPACE
+ /* Find global or static symbols in all tables that are in DOMAIN
and for which MATCH (symbol name, NAME) == 0, passing each to
CALLBACK, reading in partial symbol tables as needed. Look
through global symbols if GLOBAL and otherwise static symbols.
- Passes NAME, NAMESPACE, and DATA to CALLBACK with each symbol
+ Passes NAME, DOMAIN, and DATA to CALLBACK with each symbol
found. After each block is processed, passes NULL to CALLBACK.
MATCH must be weaker than strcmp_iw_ordered in the sense that
strcmp_iw_ordered(x,y) == 0 --> MATCH(x,y) == 0. ORDERED_COMPARE,
@@ -238,7 +238,7 @@ struct quick_symbol_functions
non-zero to indicate that the scan should be terminated. */
void (*map_matching_symbols) (struct objfile *,
- const char *name, domain_enum namespace,
+ const char *name, domain_enum domain,
int global,
int (*callback) (struct block *,
struct symbol *, void *),
--
1.8.3.1