[libvirt] [PATCH 3/4] build: delete all syntax check rules we're skipping

Daniel P. Berrangé berrange at redhat.com
Thu Oct 3 10:51:18 UTC 2019


If we've marked rules as skipped, there's no sense keeping them in the
maint.mk file.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 build-aux/cfg.mk   |  38 -------
 build-aux/maint.mk | 245 ---------------------------------------------
 2 files changed, 283 deletions(-)

diff --git a/build-aux/cfg.mk b/build-aux/cfg.mk
index 97cd4e1b70..fab5fb85ea 100644
--- a/build-aux/cfg.mk
+++ b/build-aux/cfg.mk
@@ -31,44 +31,6 @@ generated_files = \
 # We haven't converted all scripts to using gnulib's init.sh yet.
 _test_script_regex = \<\(init\|test-lib\)\.sh\>
 
-# Tests not to run as part of "make distcheck".
-local-checks-to-skip = \
-  changelog-check \
-  makefile-check \
-  makefile_path_separator_check \
-  patch-check \
-  sc_GPL_version \
-  sc_always_defined_macros \
-  sc_cast_of_alloca_return_value \
-  sc_cross_check_PATH_usage_in_tests \
-  sc_dd_max_sym_length \
-  sc_error_exit_success \
-  sc_file_system \
-  sc_immutable_NEWS \
-  sc_makefile_path_separator_check \
-  sc_obsolete_symbols \
-  sc_prohibit_S_IS_definition \
-  sc_prohibit_atoi_atof \
-  sc_prohibit_gnu_make_extensions \
-  sc_prohibit_hash_without_use \
-  sc_prohibit_jm_in_m4 \
-  sc_prohibit_quote_without_use \
-  sc_prohibit_quotearg_without_use \
-  sc_prohibit_stat_st_blocks \
-  sc_prohibit_undesirable_word_seq \
-  sc_root_tests \
-  sc_space_tab \
-  sc_sun_os_names \
-  sc_system_h_headers \
-  sc_texinfo_acronym \
-  sc_tight_scope \
-  sc_two_space_separator_in_usage \
-  sc_error_message_uppercase \
-  sc_program_name \
-  sc_require_test_exit_idiom \
-  sc_makefile_check \
-  sc_useless_cpp_parens
-
 # Most developers don't run 'make distcheck'.  We want the official
 # dist to be secure, but don't want to penalize other developers
 # using a distro that has not yet picked up the automake fix.
diff --git a/build-aux/maint.mk b/build-aux/maint.mk
index 9467815711..45ef6f03c2 100644
--- a/build-aux/maint.mk
+++ b/build-aux/maint.mk
@@ -285,24 +285,6 @@ sc_cast_of_x_alloc_return_value:
 	halt="don't cast x*alloc return value"				\
 	  $(_sc_search_regexp)
 
-sc_cast_of_alloca_return_value:
-	@prohibit='\*\) *alloca\>'					\
-	halt="don't cast alloca return value"				\
-	  $(_sc_search_regexp)
-
-sc_space_tab:
-	@prohibit='[ ]	'						\
-	halt='found SPACE-TAB sequence; remove the SPACE'		\
-	  $(_sc_search_regexp)
-
-# Don't use *scanf or the old ato* functions in "real" code.
-# They provide no error checking mechanism.
-# Instead, use strto* functions.
-sc_prohibit_atoi_atof:
-	@prohibit='\<([fs]?scanf|ato([filq]|ll)) *\('				\
-	halt='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q'	\
-	  $(_sc_search_regexp)
-
 # Use STREQ rather than comparing strcmp == 0, or != 0.
 sp_ = strcmp *\(.+\)
 sc_prohibit_strcmp:
@@ -335,51 +317,6 @@ sc_prohibit_magic_number_exit:
 	halt='use EXIT_* values rather than magic number'		\
 	  $(_sc_search_regexp)
 
-# Check that we don't use $< in non-implicit Makefile rules.
-#
-# To find the Makefiles, trace AC_CONFIG_FILES.  Using VC_LIST would
-# miss the Makefiles that are not under VC control (e.g., symlinks
-# installed for gettext).  "Parsing" (recursive) uses of SUBDIRS seems
-# too delicate.
-#
-# Use GNU Make's --print-data-base to normalize the rules into some
-# easy to parse format: they are separated by two \n.  Look for the
-# "section" about non-pattern rules (marked with "# Files") inside
-# which there are still the POSIX Make like implicit rules (".c.o").
-sc_prohibit_gnu_make_extensions_awk_ =					\
-  BEGIN {								\
-      RS = "\n\n";							\
-      in_rules = 0;							\
-  }									\
-  /^\# Files/ {								\
-      in_rules = 1;							\
-  }									\
-  /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ {		\
-      print "Error: " file ": $$< in a non implicit rule\n" $$0;	\
-      status = 1;							\
-  }									\
-  END {									\
-     exit status;							\
-  }
-sc_prohibit_gnu_make_extensions:
-	@if $(AWK) --version | grep GNU >/dev/null 2>&1; then		\
-	  (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
-	    tr ' ' '\n' |						\
-	    $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
-	    while read m; do						\
-	      $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
-	        $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1;		\
-	    done;							\
-	fi
-
-# Using EXIT_SUCCESS as the first argument to error is misleading,
-# since when that parameter is 0, error does not exit.  Use '0' instead.
-sc_error_exit_success:
-	@prohibit='error *\(EXIT_SUCCESS,'				\
-	in_vc_files='\.[chly]$$'					\
-	halt='found error (EXIT_SUCCESS'				\
-	 $(_sc_search_regexp)
-
 # "FATAL:" should be fully upper-cased in error messages
 # "WARNING:" should be fully upper-cased, or fully lower-cased
 sc_error_message_warn_fatal:
@@ -390,16 +327,6 @@ sc_error_message_warn_fatal:
 	       exit 1; }						\
 	  || :
 
-# Error messages should not start with a capital letter
-sc_error_message_uppercase:
-	@$(VC_LIST_EXCEPT)						\
-	  | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null		\
-	  | $(GREP) -E '"[A-Z]'						\
-	  | $(GREP) -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX'		\
-	  && { echo '$(ME): found capitalized error message' 1>&2;	\
-	       exit 1; }						\
-	  || :
-
 # Error messages should not end with a period
 sc_error_message_period:
 	@$(VC_LIST_EXCEPT)						\
@@ -409,13 +336,6 @@ sc_error_message_period:
 	       exit 1; }						\
 	  || :
 
-sc_file_system:
-	@prohibit=file''system						\
-	exclude='/proc/filesystems'					\
-	ignore_case=1							\
-	halt='found use of "file''system"; spell it "file system"'	\
-	  $(_sc_search_regexp)
-
 # Don't use cpp tests of this symbol.  All code assumes config.h is included.
 sc_prohibit_have_config_h:
 	@prohibit='^# *if.*HAVE''_CONFIG_H'				\
@@ -490,15 +410,6 @@ sc_prohibit_close_stream_without_use:
 sc_prohibit_getopt_without_use:
 	@h='getopt.h' re='\<getopt(_long)? *\(' $(_sc_header_without_use)
 
-# Don't include quotearg.h unless you use one of its functions.
-sc_prohibit_quotearg_without_use:
-	@h='quotearg.h' re='\<quotearg(_[^ ]+)? *\(' $(_sc_header_without_use)
-
-# Don't include quote.h unless you use one of its functions.
-sc_prohibit_quote_without_use:
-	@h='quote.h' re='\<quote((_n)? *\(|_quoting_options\>)' \
-	  $(_sc_header_without_use)
-
 # Don't include this header unless you use one of its functions.
 sc_prohibit_long_options_without_use:
 	@h='long-options.h' re='\<parse_(long_options|gnu_standard_options_only) *\(' \
@@ -543,17 +454,6 @@ sc_prohibit_xalloc_without_use:
 	re='\<($(_xa1)|$(_xa2)) *\('\
 	  $(_sc_header_without_use)
 
-# Extract function names:
-# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/hash.h
-_hash_re = \
-clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning
-_hash_fn = \<($(_hash_re)) *\(
-_hash_struct = (struct )?\<[Hh]ash_(table|tuning)\>
-sc_prohibit_hash_without_use:
-	@h='hash.h' \
-	re='$(_hash_fn)|$(_hash_struct)'\
-	  $(_sc_header_without_use)
-
 sc_prohibit_cloexec_without_use:
 	@h='cloexec.h' re='\<(set_cloexec_flag|dup_cloexec) *\(' \
 	  $(_sc_header_without_use)
@@ -694,13 +594,6 @@ sc_prohibit_verify_without_use:
 sc_prohibit_xfreopen_without_use:
 	@h='xfreopen.h' re='\<xfreopen *\(' $(_sc_header_without_use)
 
-sc_obsolete_symbols:
-	@prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>'			\
-	halt='do not use HAVE''_FCNTL_H or O'_NDELAY			\
-	  $(_sc_search_regexp)
-
-# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
-
 # Each nonempty ChangeLog line must start with a year number, or a TAB.
 sc_changelog:
 	@prohibit='^[^12	]'					\
@@ -717,39 +610,12 @@ sc_bindtextdomain:
 	halt='the above files do not call bindtextdomain'		\
 	  $(_sc_search_regexp)
 
-# Require that the final line of each test-lib.sh-using test be this one:
-# Exit $fail
-# Note: this test requires GNU grep's --label= option.
-Exit_witness_file ?= tests/test-lib.sh
-Exit_base := $(notdir $(Exit_witness_file))
-sc_require_test_exit_idiom:
-	@if test -f $(srcdir)/$(Exit_witness_file); then		\
-	  die=0;							\
-	  for i in $$($(GREP) -l -F 'srcdir/$(Exit_base)'		\
-		$$($(VC_LIST) tests)); do				\
-	    tail -n1 $$i | $(GREP) '^Exit .' > /dev/null		\
-	      && : || { die=1; echo $$i; }				\
-	  done;								\
-	  test $$die = 1 &&						\
-	    { echo 1>&2 '$(ME): the final line in each of the above is not:'; \
-	      echo 1>&2 'Exit something';				\
-	      exit 1; } || :;						\
-	fi
-
 sc_trailing_blank:
 	@prohibit='[	 ]$$'						\
 	halt='found trailing blank(s)'					\
 	exclude='^Binary file .* matches$$'				\
 	  $(_sc_search_regexp)
 
-# Match lines like the following, but where there is only one space
-# between the options and the description:
-#   -D, --all-repeated[=delimit-method]  print all duplicate lines\n
-longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
-sc_two_space_separator_in_usage:
-	@prohibit='^   *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$'		\
-	halt='help2man requires at least two spaces between an option and its description'\
-	  $(_sc_search_regexp)
 
 # A regexp matching function names like "error" that may be used
 # to emit translatable messages.
@@ -763,13 +629,6 @@ sc_unmarked_diagnostics:
 	halt='found unmarked diagnostic(s)'				\
 	  $(_sc_search_regexp)
 
-# Avoid useless parentheses like those in this example:
-# #if defined (SYMBOL) || defined (SYM2)
-sc_useless_cpp_parens:
-	@prohibit='^# *if .*defined *\('				\
-	halt='found useless parentheses in cpp directive'		\
-	  $(_sc_search_regexp)
-
 # List headers for which HAVE_HEADER_H is always true, assuming you are
 # using the appropriate gnulib module.  CAUTION: for each "unnecessary"
 # #if HAVE_HEADER_H that you remove, be sure that your project explicitly
@@ -852,12 +711,6 @@ sc_prohibit_backup_files:
 	  { echo '$(ME): found version controlled backup file' 1>&2;	\
 	    exit 1; } || :
 
-# Require the latest GPL.
-sc_GPL_version:
-	@prohibit='either ''version [^3]'				\
-	halt='GPL vN, N!=3'						\
-	  $(_sc_search_regexp)
-
 # Require the latest GFDL.  Two regexp, since some .texi files end up
 # line wrapping between 'Free Documentation License,' and 'Version'.
 _GFDL_regexp = (Free ''Documentation.*Version 1\.[^3]|Version 1\.[^3] or any)
@@ -866,15 +719,6 @@ sc_GFDL_version:
 	halt='GFDL vN, N!=3'						\
 	  $(_sc_search_regexp)
 
-# Don't use Texinfo's @acronym{}.
-# https://lists.gnu.org/r/bug-gnulib/2010-03/msg00321.html
-texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$
-sc_texinfo_acronym:
-	@prohibit='@acronym\{'						\
-	in_vc_files='$(texinfo_suffix_re_)'				\
-	halt='found use of Texinfo @acronym{}'				\
-	  $(_sc_search_regexp)
-
 cvs_keywords = \
   Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
 
@@ -928,20 +772,6 @@ sc_prohibit_empty_lines_at_EOF:
 	       exit 1; }						\
 	  || :
 
-# Make sure we don't use st_blocks.  Use ST_NBLOCKS instead.
-# This is a bit of a kludge, since it prevents use of the string
-# even in comments, but for now it does the job with no false positives.
-sc_prohibit_stat_st_blocks:
-	@prohibit='[.>]st_blocks'					\
-	halt='do not use st_blocks; use ST_NBLOCKS'			\
-	  $(_sc_search_regexp)
-
-# Make sure we don't define any S_IS* macros in src/*.c files.
-# They're already defined via gnulib's sys/stat.h replacement.
-sc_prohibit_S_IS_definition:
-	@prohibit='^ *# *define  *S_IS'					\
-	halt='do not define S_IS* macros; include <sys/stat.h>'		\
-	  $(_sc_search_regexp)
 
 # Perl block to convert a match to FILE_NAME:LINENO:TEST,
 # that is shared by two definitions below.
@@ -976,35 +806,6 @@ sc_prohibit_doubled_word:
 	  && { echo '$(ME): doubled words' 1>&2; exit 1; }		\
 	  || :
 
-# A regular expression matching undesirable combinations of words like
-# "can not"; this matches them even when the two words appear on different
-# lines, but not when there is an intervening delimiter like "#" or "*".
-# Similarly undesirable, "See @xref{...}", since an @xref should start
-# a sentence.  Explicitly prohibit any prefix of "see" or "also".
-# Also prohibit a prefix matching "\w+ +".
-# @pxref gets the same see/also treatment and should be parenthesized;
-# presume it must *not* start a sentence.
-# POSIX spells it "timestamp" rather than "time\s+stamp", so we do, too.
-bad_xref_re_ ?= (?:[\w,:;] +|(?:see|also)\s+)\@xref\{
-bad_pxref_re_ ?= (?:[.!?]|(?:see|also))\s+\@pxref\{
-prohibit_undesirable_word_seq_RE_ ?=					\
-  /(?:\bcan\s+not\b|\btime\s+stamps?\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
-prohibit_undesirable_word_seq_ =					\
-    -e 'while ($(prohibit_undesirable_word_seq_RE_))'			\
-    $(perl_filename_lineno_text_)
-# Define this to a regular expression that matches
-# any filename:dd:match lines you want to ignore.
-# The default is to ignore no matches.
-ignore_undesirable_word_sequence_RE_ ?= ^$$
-
-sc_prohibit_undesirable_word_seq:
-	@$(VC_LIST_EXCEPT)						\
-	  | xargs perl -n -0777 $(prohibit_undesirable_word_seq_)	\
-	  | $(GREP) -vE '$(ignore_undesirable_word_sequence_RE_)'	\
-	  | $(GREP) .							\
-	  && { echo '$(ME): undesirable word sequence' >&2; exit 1; }   \
-	  || :
-
 # Except for shell files and for loops, double semicolon is probably a mistake
 sc_prohibit_double_semicolon:
 	@prohibit='; *;[	{} \]*(/[/*]|$$)'			\
@@ -1074,13 +875,6 @@ NEWS_hash =								\
      | md5sum -								\
      | $(SED) 's/ .*//')
 
-# Ensure that we don't accidentally insert an entry into an old NEWS block.
-sc_immutable_NEWS:
-	@if test -f $(srcdir)/NEWS; then				\
-	  test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : ||		\
-	    { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; };	\
-	fi
-
 # Update the hash stored above.  Do this after each release and
 # for any corrections to old entries.
 update-NEWS-hash: NEWS
@@ -1159,16 +953,6 @@ sc_po_check:
 	  rm -f $@-1 $@-2;						\
 	fi
 
-# Sometimes it is useful to change the PATH environment variable
-# in Makefiles.  When doing so, it's better not to use the Unix-centric
-# path separator of ':', but rather the automake-provided '$(PATH_SEPARATOR)'.
-msg = 'Do not use ":" above; use $$(PATH_SEPARATOR) instead'
-sc_makefile_path_separator_check:
-	@prohibit='PATH[=].*:'						\
-	in_vc_files='akefile|\.mk$$'					\
-	halt=$(msg)							\
-	  $(_sc_search_regexp)
-
 # Check that 'make alpha' will not fail at the end of the process,
 # i.e., when pkg-M.N.tar.xz already exists (either in "." or in ../release)
 # and is read-only.
@@ -1204,35 +988,6 @@ sc_copyright_check:
 	halt='out of date copyright in $(texi); update it'		\
 	  $(_sc_search_regexp)
 
-# If tests/help-version exists and seems to be new enough, assume that its
-# use of init.sh and path_prepend_ is correct, and ensure that every other
-# use of init.sh is identical.
-# This is useful because help-version cross-checks prog --version
-# with $(VERSION), which verifies that its path_prepend_ invocation
-# sets PATH correctly.  This is an inexpensive way to ensure that
-# the other init.sh-using tests also get it right.
-_hv_file ?= $(srcdir)/tests/help-version
-_hv_regex_weak ?= ^ *\. .*/init\.sh"
-# Fix syntax-highlighters "
-_hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/init\.sh"
-sc_cross_check_PATH_usage_in_tests:
-	@if test -f $(_hv_file); then					\
-	  $(GREP) -l 'VERSION mismatch' $(_hv_file) >/dev/null		\
-	    || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2;	\
-		 exit 0; };						\
-	  $(GREP) -lE '$(_hv_regex_strong)' $(_hv_file) >/dev/null	\
-	    || { echo "$@: $(_hv_file) lacks conforming use of init.sh" 1>&2; \
-		 exit 1; };						\
-	  good=$$($(GREP) -E '$(_hv_regex_strong)' $(_hv_file));	\
-	  $(VC_LIST_EXCEPT)						\
-	    | xargs $(GREP) -lE '$(_hv_regex_weak)'			\
-	    | xargs $(GREP) -LFx "$$good"				\
-	    | $(GREP) .							\
-	    && { printf "$(ME): the above files use"			\
-			" path_prepend_ inconsistently\n" 1>&2;		\
-		 exit 1; }						\
-	    || :;							\
-	fi
 
 # BRE regex of file contents to identify a test script.
 _test_script_regex ?= \<init\.sh\>
-- 
2.21.0




More information about the libvir-list mailing list