summaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-03-22 12:35:31 +0000
committerYao Qi <yao.qi@linaro.org>2017-03-22 12:35:31 +0000
commitffdbe8642e74527795b695988a176f0920d58f96 (patch)
tree3bda2f4d3c3d0e7adc3e6ce77ebfb5af27165059 /gdb/linespec.c
parent9d736fbf01d20bc03804fa0cb49d99fdf6628fab (diff)
Wrap locally used classes in anonymous namespace
Both aarch64-tdep.c and arm-tdep.c defines a class instruction_reader, which violates ODR, but linker doesn't an emit error. I fix this issue by wrapping them by anonymous namespace, but I think it is better to apply this for all locally used classes. If it is a good idea to put locally used class into anonymous namespace, we should document this rule into GDB coding convention, or even GCC coding convention. Note that anonymous namespace has been used in GCC but GCC coding convention doesn't mention the it. gdb: 2017-03-22 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c: Wrap locally used classes in anonymous namespace. * arm-tdep.c: Likewise. * linespec.c: Likewise. * ui-out.c: Likewise.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 72bcd604ff..a3cb0cbba1 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2793,6 +2793,8 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg)
return values;
}
+namespace {
+
/* A function object that serves as symbol_found_callback_ftype
callback for iterate_over_symbols. This is used by
lookup_prefix_sym to collect type symbols. */
@@ -2859,6 +2861,8 @@ decode_compound_collector::operator () (symbol *sym)
return true; /* Continue iterating. */
}
+} // namespace
+
/* Return any symbols corresponding to CLASS_NAME in FILE_SYMTABS. */
static VEC (symbolp) *
@@ -3095,6 +3099,8 @@ find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs,
+namespace {
+
/* This function object is a callback for iterate_over_symtabs, used
when collecting all matching symtabs. */
@@ -3148,6 +3154,8 @@ symtab_collector::operator () (struct symtab *symtab)
return false;
}
+} // namespace
+
/* Given a file name, return a VEC of all matching symtabs. If
SEARCH_PSPACE is not NULL, the search is restricted to just that
program space. */