[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint.mk: add a syntax-check rule to ensure tightly-scoped s
From: |
Jim Meyering |
Subject: |
Re: [PATCH] maint.mk: add a syntax-check rule to ensure tightly-scoped symbols |
Date: |
Wed, 18 May 2011 09:07:57 +0200 |
Pádraig Brady wrote:
> On 17/05/11 15:23, Pádraig Brady wrote:
>> Given '^__.*' names are reserved by the compiler,
>> perhaps the happy medium is to to allow single underscores,
>> but exclude double underscores, with something like:
>
> I'm going with the following, so as to not put the
> onus on users configuring an exclude list, to include
> the __.* pattern.
> Subject: [PATCH] maint.mk: exclude compiler symbols from sc_tight_scope
...
> @@ -1391,7 +1394,7 @@ _gl_tight_scope: $(bin_PROGRAMS)
> test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
> hdr=`for f in $(noinst_HEADERS); do \
> test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
> - ( printf '^%s$$\n' $(_gl_TS_unmarked_extern_functions); \
> + ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_functions); \
> grep -h -A1 '^extern .*[^;]$$' $$src \
> | grep -vE '^(extern |--)' | sed 's/ .*//'; \
> perl -lne '$(_gl_TS_function_match)' \
> @@ -1400,7 +1403,7 @@ _gl_tight_scope: $(bin_PROGRAMS)
> nm -e *.$(OBJEXT) | sed -n 's/.* T //p' | grep -Ev -f $$t \
> && { echo the above functions should have static scope >&2; \
> exit 1; } || : ; \
> - ( printf '^%s$$\n' $(_gl_TS_unmarked_extern_vars); \
> + ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_vars); \
> perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"' \
> $$hdr *.h ) | sort -u > $$t; \
> nm -e *.$(OBJEXT) | sed -n 's/.* [BCDGRS] //p' \
Perfect. Thanks!