Codebase list virt-viewer / c838418
build: delete all syntax check rules we're skipping 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@redhat.com> Daniel P. Berrangé 3 years ago
2 changed file(s) with 0 addition(s) and 232 deletion(s). Raw diff Collapse all Expand all
1313
1414 # You should have received a copy of the GNU General Public License
1515 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 # Tests not to run as part of "make distcheck".
18 local-checks-to-skip = \
19 changelog-check \
20 makefile-check \
21 makefile_path_separator_check \
22 patch-check \
23 sc_GPL_version \
24 sc_always_defined_macros \
25 sc_bindtextdomain \
26 sc_cast_of_alloca_return_value \
27 sc_cross_check_PATH_usage_in_tests \
28 sc_dd_max_sym_length \
29 sc_error_exit_success \
30 sc_file_system \
31 sc_immutable_NEWS \
32 sc_makefile_path_separator_check \
33 sc_obsolete_symbols \
34 sc_prohibit_always_true_header_tests \
35 sc_prohibit_S_IS_definition \
36 sc_prohibit_atoi_atof \
37 sc_prohibit_hash_without_use \
38 sc_prohibit_jm_in_m4 \
39 sc_prohibit_quote_without_use \
40 sc_prohibit_quotearg_without_use \
41 sc_prohibit_stat_st_blocks \
42 sc_root_tests \
43 sc_space_tab \
44 sc_sun_os_names \
45 sc_system_h_headers \
46 sc_texinfo_acronym \
47 sc_tight_scope \
48 sc_two_space_separator_in_usage \
49 sc_error_message_uppercase \
50 sc_program_name \
51 sc_require_test_exit_idiom \
52 sc_makefile_check \
53 sc_useless_cpp_parens
5416
5517 # Files that should never cause syntax check failures.
5618 VC_LIST_ALWAYS_EXCLUDE_REGEX = \
233233 halt='don'\''t cast x*alloc return value' \
234234 $(_sc_search_regexp)
235235
236 sc_cast_of_alloca_return_value:
237 @prohibit='\*\) *alloca\>' \
238 halt='don'\''t cast alloca return value' \
239 $(_sc_search_regexp)
240
241 sc_space_tab:
242 @prohibit='[ ] ' \
243 halt='found SPACE-TAB sequence; remove the SPACE' \
244 $(_sc_search_regexp)
245
246 # Don't use *scanf or the old ato* functions in `real' code.
247 # They provide no error checking mechanism.
248 # Instead, use strto* functions.
249 sc_prohibit_atoi_atof:
250 @prohibit='\<([fs]?scanf|ato([filq]|ll)) *\(' \
251 halt='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
252 $(_sc_search_regexp)
253
254236 # Use STREQ rather than comparing strcmp == 0, or != 0.
255237 sc_prohibit_strcmp:
256238 @grep -nE '! *str''cmp *\(|\<str''cmp *\(.+\) *[!=]=' \
274256 halt='use EXIT_* values rather than magic number' \
275257 $(_sc_search_regexp)
276258
277 # Using EXIT_SUCCESS as the first argument to error is misleading,
278 # since when that parameter is 0, error does not exit. Use `0' instead.
279 sc_error_exit_success:
280 @prohibit='error *\(EXIT_SUCCESS,' \
281 in_vc_files='\.[chly]$$' \
282 halt='found error (EXIT_SUCCESS' \
283 $(_sc_search_regexp)
284
285259 # `FATAL:' should be fully upper-cased in error messages
286260 # `WARNING:' should be fully upper-cased, or fully lower-cased
287261 sc_error_message_warn_fatal:
290264 { echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
291265 exit 1; } || :
292266
293 # Error messages should not start with a capital letter
294 sc_error_message_uppercase:
295 @grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
296 | grep -E '"[A-Z]' \
297 | grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
298 { echo '$(ME): found capitalized error message' 1>&2; \
299 exit 1; } || :
300
301267 # Error messages should not end with a period
302268 sc_error_message_period:
303269 @grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
304270 | grep -E '[^."]\."' && \
305271 { echo '$(ME): found error message ending in period' 1>&2; \
306272 exit 1; } || :
307
308 sc_file_system:
309 @prohibit=file''system \
310 ignore_case=1 \
311 halt='found use of "file''system"; spell it "file system"' \
312 $(_sc_search_regexp)
313273
314274 # Don't use cpp tests of this symbol. All code assumes config.h is included.
315275 sc_prohibit_have_config_h:
375335 # Prohibit the inclusion of getopt.h without an actual use.
376336 sc_prohibit_getopt_without_use:
377337 @h='getopt.h' re='\<getopt(_long)? *\(' $(_sc_header_without_use)
378
379 # Don't include quotearg.h unless you use one of its functions.
380 sc_prohibit_quotearg_without_use:
381 @h='quotearg.h' re='\<quotearg(_[^ ]+)? *\(' $(_sc_header_without_use)
382
383 # Don't include quote.h unless you use one of its functions.
384 sc_prohibit_quote_without_use:
385 @h='quote.h' re='\<quote(_n)? *\(' $(_sc_header_without_use)
386338
387339 # Don't include this header unless you use one of its functions.
388340 sc_prohibit_long_options_without_use:
426378 sc_prohibit_xalloc_without_use:
427379 @h='xalloc.h' \
428380 re='\<($(_xa1)|$(_xa2)) *\('\
429 $(_sc_header_without_use)
430
431 # Extract function names:
432 # perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/hash.h
433 _hash_re = \
434 clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning
435 _hash_fn = \<($(_hash_re)) *\(
436 _hash_struct = (struct )?\<[Hh]ash_(table|tuning)\>
437 sc_prohibit_hash_without_use:
438 @h='hash.h' \
439 re='$(_hash_fn)|$(_hash_struct)'\
440381 $(_sc_header_without_use)
441382
442383 sc_prohibit_cloexec_without_use:
585526 sc_prohibit_xfreopen_without_use:
586527 @h='xfreopen.h' re='\<xfreopen *\(' $(_sc_header_without_use)
587528
588 sc_obsolete_symbols:
589 @prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
590 halt='do not use HAVE''_FCNTL_H or O'_NDELAY \
591 $(_sc_search_regexp)
592
593 # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
594
595529 # Each nonempty ChangeLog line must start with a year number, or a TAB.
596530 sc_changelog:
597531 @prohibit='^[^12 ]' \
599533 halt='found unexpected prefix in a ChangeLog' \
600534 $(_sc_search_regexp)
601535
602 # Ensure that each .c file containing a "main" function also
603 # calls set_program_name.
604 sc_program_name:
605 @require='set_program_name *\(m?argv\[0\]\);' \
606 in_vc_files='\.c$$' \
607 containing='\<main *(' \
608 halt='the above files do not call set_program_name' \
609 $(_sc_search_regexp)
610
611 # Ensure that each .c file containing a "main" function also
612 # calls bindtextdomain.
613 sc_bindtextdomain:
614 @require='bindtextdomain *\(' \
615 in_vc_files='\.c$$' \
616 containing='\<main *(' \
617 halt='the above files do not call bindtextdomain' \
618 $(_sc_search_regexp)
619
620 # Require that the final line of each test-lib.sh-using test be this one:
621 # Exit $fail
622 # Note: this test requires GNU grep's --label= option.
623 Exit_witness_file ?= tests/test-lib.sh
624 Exit_base := $(notdir $(Exit_witness_file))
625 sc_require_test_exit_idiom:
626 @if test -f $(srcdir)/$(Exit_witness_file); then \
627 die=0; \
628 for i in $$(grep -l -F 'srcdir/$(Exit_base)' \
629 $$($(VC_LIST) tests)); do \
630 tail -n1 $$i | grep '^Exit .' > /dev/null \
631 && : || { die=1; echo $$i; } \
632 done; \
633 test $$die = 1 && \
634 { echo 1>&2 '$(ME): the final line in each of the above is not:'; \
635 echo 1>&2 'Exit something'; \
636 exit 1; } || :; \
637 fi
638
639536 sc_trailing_blank:
640537 @prohibit='[ ]$$' \
641538 halt='found trailing blank(s)' \
642 $(_sc_search_regexp)
643
644 # Match lines like the following, but where there is only one space
645 # between the options and the description:
646 # -D, --all-repeated[=delimit-method] print all duplicate lines\n
647 longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
648 sc_two_space_separator_in_usage:
649 @prohibit='^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
650 halt='help2man requires at least two spaces between an option and its description'\
651539 $(_sc_search_regexp)
652540
653541 # A regexp matching function names like "error" that may be used
664552 { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
665553 exit 1; } || :
666554
667 # Avoid useless parentheses like those in this example:
668 # #if defined (SYMBOL) || defined (SYM2)
669 sc_useless_cpp_parens:
670 @prohibit='^# *if .*defined *\(' \
671 halt='found useless parentheses in cpp directive' \
672 $(_sc_search_regexp)
673
674555 # Prohibit checked in backup files.
675556 sc_prohibit_backup_files:
676557 @$(VC_LIST) | grep '~$$' && \
677558 { echo '$(ME): found version controlled backup file' 1>&2; \
678559 exit 1; } || :
679
680 # Require the latest GPL.
681 sc_GPL_version:
682 @prohibit='either ''version [^3]' \
683 halt='GPL vN, N!=3' \
684 $(_sc_search_regexp)
685560
686561 # Require the latest GFDL. Two regexp, since some .texi files end up
687562 # line wrapping between 'Free Documentation License,' and 'Version'.
689564 sc_GFDL_version:
690565 @prohibit='$(_GFDL_regexp)' \
691566 halt='GFDL vN, N!=3' \
692 $(_sc_search_regexp)
693
694 # Don't use Texinfo's @acronym{}.
695 # http://lists.gnu.org/archive/html/bug-gnulib/2010-03/msg00321.html
696 texinfo_suffix_re_ ?= \.(txi|texi(nfo)?)$$
697 sc_texinfo_acronym:
698 @prohibit='@acronym\{' \
699 in_vc_files='$(texinfo_suffix_re_)' \
700 halt='found use of Texinfo @acronym{}' \
701 $(_sc_search_regexp)
702
703 cvs_keywords = \
704 Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
705
706 sc_prohibit_cvs_keyword:
707 @prohibit='\$$($(cvs_keywords))\$$' \
708 halt='do not use CVS keyword expansion' \
709567 $(_sc_search_regexp)
710568
711569 # This Perl code is slightly obfuscated. Not only is each "$" doubled
750608 @perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
751609 || { echo '$(ME): empty line(s) or no newline at EOF' \
752610 1>&2; exit 1; } || :
753
754 # Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
755 # This is a bit of a kludge, since it prevents use of the string
756 # even in comments, but for now it does the job with no false positives.
757 sc_prohibit_stat_st_blocks:
758 @prohibit='[.>]st_blocks' \
759 halt='do not use st_blocks; use ST_NBLOCKS' \
760 $(_sc_search_regexp)
761
762 # Make sure we don't define any S_IS* macros in src/*.c files.
763 # They're already defined via gnulib's sys/stat.h replacement.
764 sc_prohibit_S_IS_definition:
765 @prohibit='^ *# *define *S_IS' \
766 halt='do not define S_IS* macros; include <sys/stat.h>' \
767 $(_sc_search_regexp)
768611
769612 # Perl block to convert a match to FILE_NAME:LINENO:TEST,
770613 # that is shared by two definitions below.
934777 rm -f $@-1 $@-2; \
935778 fi
936779
937 # Sometimes it is useful to change the PATH environment variable
938 # in Makefiles. When doing so, it's better not to use the Unix-centric
939 # path separator of `:', but rather the automake-provided `$(PATH_SEPARATOR)'.
940 msg = '$(ME): Do not use `:'\'' above; use $$(PATH_SEPARATOR) instead'
941 sc_makefile_path_separator_check:
942 @prohibit='PATH[=].*:' \
943 in_vc_files='akefile|\.mk$$' \
944 halt=$(msg) \
945 $(_sc_search_regexp)
946
947 # If tests/help-version exists and seems to be new enough, assume that its
948 # use of init.sh and path_prepend_ is correct, and ensure that every other
949 # use of init.sh is identical.
950 # This is useful because help-version cross-checks prog --version
951 # with $(VERSION), which verifies that its path_prepend_ invocation
952 # sets PATH correctly. This is an inexpensive way to ensure that
953 # the other init.sh-using tests also get it right.
954 _hv_file ?= $(srcdir)/tests/help-version
955 _hv_regex_weak ?= ^ *\. .*/init\.sh"
956 # Fix syntax-highlighters "
957 _hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/init\.sh"
958 sc_cross_check_PATH_usage_in_tests:
959 @if test -f $(_hv_file); then \
960 grep -l 'VERSION mismatch' $(_hv_file) >/dev/null \
961 || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2; \
962 exit 0; }; \
963 grep -lE '$(_hv_regex_strong)' $(_hv_file) >/dev/null \
964 || { echo "$@: $(_hv_file) lacks conforming use of init.sh" 1>&2; \
965 exit 1; }; \
966 good=$$(grep -E '$(_hv_regex_strong)' $(_hv_file)); \
967 grep -LFx "$$good" \
968 $$(grep -lE '$(_hv_regex_weak)' $$($(VC_LIST_EXCEPT))) \
969 | grep . && \
970 { echo "$(ME): the above files use path_prepend_ inconsistently" \
971 1>&2; exit 1; } || :; \
972 fi
973
974780 # #if HAVE_... will evaluate to false for any non numeric string.
975781 # That would be flagged by using -Wundef, however gnulib currently
976782 # tests many undefined macros, and so we can't enable that option.