From ffdbe8642e74527795b695988a176f0920d58f96 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 22 Mar 2017 12:35:31 +0000 Subject: 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 * aarch64-tdep.c: Wrap locally used classes in anonymous namespace. * arm-tdep.c: Likewise. * linespec.c: Likewise. * ui-out.c: Likewise. --- gdb/ui-out.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/ui-out.c') diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 42cffbe..9c27742 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -30,6 +30,8 @@ #include #include +namespace { + /* A header of a ui_out_table. */ class ui_out_hdr @@ -91,6 +93,8 @@ class ui_out_hdr std::string m_header; }; +} // namespace + /* A level of nesting (either a list or a tuple) in a ui_out output. */ class ui_out_level -- cgit v1.1