On Tue, Apr 15, 2014 at 7:33 PM, Patrick Palka <patr...@parcs.ath.cx> wrote: > On Tue, Apr 15, 2014 at 3:51 AM, Richard Biener > <richard.guent...@gmail.com> wrote: >> On Mon, Apr 14, 2014 at 4:51 PM, Patrick Palka <patr...@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.
Existing uses at least add vertical spacing after namespace { and before the corresponding closing }, adding // anon namespace after that. Thus the patch is ok with that style change. Thanks, Richard.