]> Savannah Git Hosting - gnulib.git/commitdiff
maint.mk: sc_tight_scope: factor and support OS X
authorJim Meyering <meyering@fb.com>
Sun, 18 Oct 2015 03:12:48 +0000 (20:12 -0700)
committerJim Meyering <meyering@fb.com>
Sun, 18 Oct 2015 03:33:35 +0000 (20:33 -0700)
* top/maint.mk (_gl_tight_scope): Address three issues:
- factor out four instances of code that wraps a string in "^...$"
- allow nm-reported symbol names to have an optional leading "_"
- add "main" to the list of ignored variable names, because on os x,
"main" has nm-reported type "S" in the variable-checking section.

ChangeLog
top/maint.mk

index bc71d2ed0077fde943ebeda0a62c2b0622953498..7dafb8b7f2ce03de5d5f075c0cc162c90018c950 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-10-17  Jim Meyering  <meyering@fb.com>
+
+       maint.mk: sc_tight_scope: factor and support OS X
+       * top/maint.mk (_gl_tight_scope): Address three issues:
+       - factor out four instances of code that wraps a string in "^...$"
+       - allow nm-reported symbol names to have an optional leading "_"
+       - add "main" to the list of ignored variable names, because on os x,
+       "main" has nm-reported type "S" in the variable-checking section.
+
 2015-10-16  Dmitry Smirnov  <onlyjob@member.fsf.org>
 
        safe-alloc-tests: fix typo in license header
index b6ec1b5e16d66255776a20546f798b908a237491..6fb6d841f7b71841db76f68210a3488f62a097e8 100644 (file)
@@ -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/ .*//';              \
          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;   \