This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Wrap locally used classes in anonymous namespace
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 22 Mar 2017 12:37:25 +0000
- Subject: Re: [PATCH] Wrap locally used classes in anonymous namespace
- Authentication-results: sourceware.org; auth=none
- References: <1490006948-13255-1-git-send-email-yao.qi@linaro.org>
On Mon, Mar 20, 2017 at 10:49 AM, Yao Qi <qiyaoltc@gmail.com> wrote:
> 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-20 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.
Patch is pushed in.
--
Yao (齐尧)