]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(sc_tight_scope): Also check for global variables, (BSS section).
authorJim Meyering <jim@meyering.net>
Tue, 27 Apr 2004 17:03:58 +0000 (17:03 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 27 Apr 2004 17:03:58 +0000 (17:03 +0000)
src/Makefile.am

index dbe7172a69a9e1a372638ffaaa12556a09f6a416..463422398bdacc3a0bffa059eeb86629a8a8ad46 100644 (file)
@@ -278,6 +278,8 @@ s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
 # Any that don't must be marked with `extern', but `main'
 # and `usage' are exceptions.  They're always extern, but
 # don't need to be marked.
+#
+# The second nm|grep checks for file-scope variables with `extern' scope.
 sc_tight_scope: $(all_programs)
        @t=exceptions-$$$$;                                             \
        trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15;                  \
@@ -288,4 +290,10 @@ sc_tight_scope: $(all_programs)
            | sed -n 's/.* T //p'                                       \
            | grep -Ev -f $$t &&                                        \
          { echo 'the above functions should have static scope' 1>&2;   \
+           exit 1; } || : ;                                            \
+       printf '^program_name$$\n' > $$t;                               \
+       nm -e *.$(OBJEXT)                                               \
+           | sed -n 's/.* B //p'                                       \
+           | grep -Ev -f $$t &&                                        \
+         { echo 'the above variables should have static scope' 1>&2;   \
            exit 1; } || :