summaryrefslogtreecommitdiff
path: root/maint.mk
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-01-29 10:44:10 +0100
committerJim Meyering <meyering@redhat.com>2009-01-29 13:30:45 +0100
commit60ca9e1599ed5c9a1a06130d915438cbb32ab391 (patch)
tree0595b7d1901474892af31600d6d880e341ca2598 /maint.mk
parent0889381cbfdbb4895e6b8693d14c0f5c77bc85bc (diff)
downloadcoreutils-60ca9e1599ed5c9a1a06130d915438cbb32ab391.tar.xz
maint: factor syntax-check rules
* maint.mk (_ignore_case): New macro. (_prohibit_regexp): Use it. Factor many existing syntax-check rules to use $(_prohibit_regexp).
Diffstat (limited to 'maint.mk')
-rw-r--r--maint.mk40
1 files changed, 20 insertions, 20 deletions
diff --git a/maint.mk b/maint.mk
index 4b449d8ed..38724c24d 100644
--- a/maint.mk
+++ b/maint.mk
@@ -62,8 +62,6 @@ release_archive_dir ?= ../release
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
-
-
## --------------- ##
## Sanity checks. ##
## --------------- ##
@@ -92,6 +90,10 @@ syntax-check: $(local-check)
# exit 1; } || :
# FIXME: don't allow `#include .strings\.h' anywhere
+# By default, _prohibit_regexp does not ignore case.
+export ignore_case =
+_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
+
# There are many rules below that prohibit constructs in this package.
# If the offending construct can be matched with a grep-E-style regexp,
# use this macro. The shell variables "re" and "msg" must be defined.
@@ -99,7 +101,7 @@ define _prohibit_regexp
dummy=; : so we do not need a semicolon before each use \
test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
- grep -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
+ grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
endef
@@ -175,13 +177,12 @@ sc_error_message_period:
exit 1; } || :
sc_file_system:
- @grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found use of "file''system";' \
- 'rewrite to use "file system"' 1>&2; \
- exit 1; } || :
+ @re=file''system ignore_case=1 \
+ msg='found use of "file''system"; spell it "file system"' \
+ $(_prohibit_regexp)
# Don't use cpp tests of this symbol. All code assumes config.h is included.
-sc_no_have_config_h:
+sc_prohibit_have_config_h:
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
1>&2; exit 1; } || :
@@ -278,10 +279,9 @@ sc_prohibit_root_dev_ino_without_use:
$(_header_without_use)
sc_obsolete_symbols:
- @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
- $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY' \
- 1>&2; exit 1; } || :
+ @re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
+ msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
+ $(_prohibit_regexp)
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
@@ -320,14 +320,14 @@ sc_require_test_exit_idiom:
fi
sc_the_the:
- @grep -ni '\<the ''the\>' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found use of "the ''the";' 1>&2; \
- exit 1; } || :
+ @re='\<the ''the\>' \
+ ignore_case=1 msg='found use of "the ''the";' \
+ $(_prohibit_regexp)
sc_trailing_blank:
- @grep -n '[ ]$$' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): found trailing blank(s)' \
- 1>&2; exit 1; } || :
+ @re='[ ]$$' \
+ ignore_case=1 msg='found trailing blank(s)' \
+ $(_prohibit_regexp)
# Match lines like the following, but where there is only one space
# between the options and the description:
@@ -358,8 +358,8 @@ sc_useless_cpp_parens:
# Require the latest GPL.
sc_GPL_version:
- @grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) && \
- { echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
+ @re='either ''version [^3]' msg='GPL vN, N!=3' \
+ $(_prohibit_regexp)
cvs_keywords = \
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State