Wrap locally used classes in anonymous namespace
authorYao Qi <yao.qi@linaro.org>
Wed, 22 Mar 2017 12:35:31 +0000 (12:35 +0000)
committerYao Qi <yao.qi@linaro.org>
Wed, 22 Mar 2017 12:35:31 +0000 (12:35 +0000)
commitffdbe8642e74527795b695988a176f0920d58f96
tree3bda2f4d3c3d0e7adc3e6ce77ebfb5af27165059
parent9d736fbf01d20bc03804fa0cb49d99fdf6628fab
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.
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/arm-tdep.c
gdb/linespec.c
gdb/ui-out.c
This page took 0.02458 seconds and 4 git commands to generate.