This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [CLEANUP] Wrap locally-used functions in anonymous namespaces
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 15 Apr 2014 13:33:07 -0400
- Subject: Re: [PATCH] [CLEANUP] Wrap locally-used functions in anonymous namespaces
- Authentication-results: sourceware.org; auth=none
- References: <1397487116-30043-1-git-send-email-patrick at parcs dot ath dot cx> <CAFiYyc155q-m9q59tZ+pXiEwKFtkPmAd49=k2Ogbw=NrA6EAmg at mail dot gmail dot com>
On Tue, Apr 15, 2014 at 3:51 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Mon, Apr 14, 2014 at 4:51 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
>> Hi everyone,
>>
>> This patch wraps a bunch of locally-used, non-debug functions in an
>> anonymous namespace. These functions can't simply be marked as "static"
>> because they are used as template arguments to hash_table::traverse, and
>> the C++98 standard does not allow non-extern variables to be used as
>> template arguments. The next best thing to marking them static is to
>> define each of these functions inside an anonymous namespace.
>
> Hum, the formatting used looks super-ugly. I suppose a local visibility
> attribute would work as well? (well, what's the goal of the patch?)
>
> Thanks,
> Richard.
The goal of this patch is to resolve warnings emitted by
-Wmissing-declarations for the GCC sources. Later I would like to
propose adding -Wmissing-declarations to GCC's build flags, but I
figured that these kinds of cleanup patches are good on their own.
I don't think a local visibility attribute would squelch the
-Wmissing-declaration warnings. Is there a better/standardized format
for defining a function within an anonymous namespace? I personally
don't think the formatting is too bad.