summaryrefslogtreecommitdiff
path: root/gdb/aarch64-tdep.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/aarch64-tdep.c
parent9d736fbf01d20bc03804fa0cb49d99fdf6628fab (diff)
downloadbinutils-gdb-ffdbe8642e74527795b695988a176f0920d58f96.tar.gz
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/aarch64-tdep.c')
-rw-r--r--gdb/aarch64-tdep.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index e7d0844c762..f6bac370309 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -196,6 +196,8 @@ show_aarch64_debug (struct ui_file *file, int from_tty,
fprintf_filtered (file, _("AArch64 debugging is %s.\n"), value);
}
+namespace {
+
/* Abstract instruction reader. */
class abstract_instruction_reader
@@ -217,6 +219,8 @@ class instruction_reader : public abstract_instruction_reader
}
};
+} // namespace
+
/* Analyze a prologue, looking for a recognizable stack frame
and frame pointer. Scan until we encounter a store that could
clobber the stack frame unexpectedly, or an unknown instruction. */