[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
use gnulib's scope-checking syntax-check rule
From: |
Jim Meyering |
Subject: |
use gnulib's scope-checking syntax-check rule |
Date: |
Fri, 13 May 2011 10:50:06 +0200 |
FYI, I've just pushed this.
No semantic change.
>From d289504fbe5b527598a479495508d11a86ea4e56 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 8 May 2011 15:21:32 +0200
Subject: [PATCH 1/3] maint: use consistent declaration syntax
* src/grep.h (matchers): Declare consistently, so the sc_tight_scope
rule detects this as an extern-marked variable.
---
src/grep.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/grep.h b/src/grep.h
index d1dd214..1fef4b6 100644
--- a/src/grep.h
+++ b/src/grep.h
@@ -30,12 +30,13 @@ typedef size_t (*execute_fp_t) (char const *, size_t,
size_t *, char const *);
/* grep.c expects the matchers vector to be terminated by an entry
with a NULL name, and to contain at least one entry. */
-extern struct matcher
+struct matcher
{
const char *name;
compile_fp_t compile;
execute_fp_t execute;
-} const matchers[];
+};
+extern const struct matcher matchers[];
extern const char before_options[];
extern const char after_options[];
--
1.7.5.1.398.g86d1d
>From 31fe68771f7ff732606a1d4c88c7b7304bf66ae0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 7 May 2011 19:47:24 +0200
Subject: [PATCH 2/3] maint: remove syntax-checking sc_tight_scope rule
* src/Makefile.am (sc_tight_scope): Remove rule.
Now it's provided via gnulib's maint.mk.
* cfg.mk (sc_tight_scope): Likewise.
---
cfg.mk | 4 ----
src/Makefile.am | 40 ----------------------------------------
2 files changed, 0 insertions(+), 44 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 035a299..9b7b93d 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -54,10 +54,6 @@ sc_prohibit_emacs__indent_tabs_mode__setting:
halt='use of emacs indent-tabs-mode: setting' \
$(_sc_search_regexp)
-ALL_RECURSIVE_TARGETS = sc_tight_scope
-sc_tight_scope:
- @$(MAKE) -s -C src $@
-
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
diff --git a/src/Makefile.am b/src/Makefile.am
index ec3e176..257472b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,43 +45,3 @@ localedir = $(datadir)/locale
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
EXTRA_DIST = dosbuf.c
-
-# The following rule is not designed to be portable,
-# and relies on tools that not everyone has.
-
-# Most functions in src/*.c should have static scope.
-# Any that don't must be marked with `extern', but `main'
-# and `usage' are exceptions: they're always extern, but
-# do not need to be marked. Also functions starting with __
-# are exempted due to possibly being added by the compiler
-# (when compiled as a shared library for example).
-#
-# The second nm|grep checks for file-scope variables with `extern' scope.
-.PHONY: sc_tight_scope
-sc_tight_scope: $(bin_PROGRAMS)
- @t=exceptions-$$$$; \
- trap 's=$$?; rm -f $$t; exit $$s' 0; \
- for sig in 1 2 3 13 15; do \
- eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \
- done; \
- src=`for f in $(SOURCES); do \
- 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 'main\nusage\n_.*\n'; \
- grep -h -A1 '^extern .*[^;]$$' $$src \
- | grep -vE '^(extern |--)' | sed 's/ .*//'; \
- perl -lne '/^extern (?:struct |const |enum )?\S+ \**(\S*) \(/'\
- -e 'and print $$1' $$hdr; \
- ) | sort -u | sed 's/^/^/;s/$$/$$/' > $$t; \
- nm -e *.$(OBJEXT) | sed -n 's/.* T //p' \
- | sed 's/^_//' | grep -Ev -f $$t \
- && { echo the above functions should have static scope >&2; \
- exit 1; } || : ; \
- ( printf '^program_name$$\n'; \
- perl -lne '/^extern .*?\**(\w+);/ and print "^$$1\$$"' \
- $$hdr *.h ) | sort -u > $$t; \
- nm -e *.$(OBJEXT) | sed -n 's/.* [BD] //p' \
- | sed 's/^_//' | grep -Ev -f $$t \
- && { echo the above variables should have static scope >&2; \
- exit 1; } || :
--
1.7.5.1.398.g86d1d
>From 58d798246c0c2b211a9f1279d61a25b99ff96728 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 13 May 2011 10:42:30 +0200
Subject: [PATCH 3/3] build: update gnulib submodule to latest
---
gnulib | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gnulib b/gnulib
index c1a8825..4104cd4 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit c1a8825410ad58e8344bdb202b2559935179e513
+Subproject commit 4104cd4f7746f8ba7e75e3292c78c2c528b0c88a
--
1.7.5.1.398.g86d1d
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- use gnulib's scope-checking syntax-check rule,
Jim Meyering <=