This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [CLEANUP] Wrap locally-used functions in anonymous namespaces


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]