summaryrefslogtreecommitdiff
path: root/maint.mk
diff options
context:
space:
mode:
Diffstat (limited to 'maint.mk')
-rw-r--r--maint.mk17
1 files changed, 9 insertions, 8 deletions
diff --git a/maint.mk b/maint.mk
index b6ec1b5..893874b 100644
--- a/maint.mk
+++ b/maint.mk
@@ -1600,7 +1600,7 @@ ifeq (a,b)
# do not need to be marked. Symbols matching '__.*' are
# reserved by the compiler, so are automatically excluded below.
_gl_TS_unmarked_extern_functions ?= main usage
-_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\S+) *\(/
+_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\w+) *\(/
# If your project uses a macro like "XTERN", then put
# the following in cfg.mk to override this default:
@@ -1633,6 +1633,7 @@ _gl_TS_other_headers ?= *.h
.PHONY: _gl_tight_scope
_gl_tight_scope: $(bin_PROGRAMS)
+ sed_wrap='s/^/^_?/;s/$$/$$/'; \
t=exceptions-$$$$; \
trap 's=$$?; rm -f $$t; exit $$s' 0; \
for sig in 1 2 3 13 15; do \
@@ -1642,19 +1643,19 @@ _gl_tight_scope: $(bin_PROGRAMS)
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
hdr=`for f in $(_gl_TS_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/ .*//'; \
+ | grep -vE '^(extern |--|#)' | $(SED) 's/ .*//; /^$$/d'; \
perl -lne \
- '$(_gl_TS_function_match) and print "^$$1\$$"' $$hdr; \
- ) | sort -u > $$t; \
+ '$(_gl_TS_function_match) and print $$1' $$hdr; \
+ ) | sort -u | $(SED) "$$sed_wrap" > $$t; \
nm -g $(_gl_TS_obj_files)|$(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); \
- perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"' \
+ ( printf '%s\n' '__.*' main $(_gl_TS_unmarked_extern_vars); \
+ perl -lne '$(_gl_TS_var_match) and print $$1' \
$$hdr $(_gl_TS_other_headers) \
- ) | sort -u > $$t; \
+ ) | sort -u | $(SED) "$$sed_wrap" > $$t; \
nm -g $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p' \
| sort -u | grep -Ev -f $$t \
&& { echo the above variables should have static scope >&2; \