+# Use framework_failure_, not the old name without the trailing underscore.
+sc_prohibit_framework_failure:
+ @prohibit='\<framework_''failure\>' \
+ halt='use framework_failure_ instead' \
+ $(_sc_search_regexp)
+
+# Prohibit the use of `...` in tests/. Use $(...) instead.
+sc_prohibit_test_backticks:
+ @prohibit='`' in_vc_files='^tests/' \
+ halt='use $$(...), not `...` in tests/' \
+ $(_sc_search_regexp)
+
+# Programs like sort, ls, expr use PROG_FAILURE in place of EXIT_FAILURE.
+# Others, use the EXIT_CANCELED, EXIT_ENOENT, etc. macros defined in system.h.
+# In those programs, ensure that EXIT_FAILURE is not used by mistake.
+sc_some_programs_must_avoid_exit_failure:
+ @grep -nw EXIT_FAILURE \
+ $$(git grep -El '[^T]_FAILURE|EXIT_CANCELED' src) \
+ | grep -vE '= EXIT_FAILURE|exit \(.* \?' | grep . \
+ && { echo '$(ME): do not use EXIT_FAILURE in the above' \
+ 1>&2; exit 1; } || :
+
+# Ensure that tests call the print_ver_ function for programs which are
+# actually used in that test.
+sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
+ @git grep -w print_ver_ tests \
+ | sed 's#:print_ver_##' \
+ | { fail=0; \
+ while read file name; do \
+ for i in $$name; do \
+ case "$$i" in install) i=ginstall;; esac; \
+ grep -w "$$i" $$file|grep -vw print_ver_|grep -q . \
+ || { fail=1; \
+ echo "*** Test: $$file, offending: $$i." 1>&2; };\
+ done; \
+ done; \
+ test $$fail = 0 || exit 1; \
+ } || { echo "$(ME): the above test(s) call print_ver_ for" \
+ "program(s) they don't use" 1>&2; exit 1; }
+
+# Exempt the contents of any usage function from the following.
+_continued_string_col_1 = \
+s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e}
+# Ding any source file that has a continued string with an alphabetic in the
+# first column of the following line. We prohibit them because they usually
+# trigger false positives in tools that try to map an arbitrary line number
+# to the enclosing function name. Of course, very many strings do precisely
+# this, *when they are part of the usage function*. That is why we exempt
+# the contents of any function named "usage".
+sc_prohibit_continued_string_alpha_in_column_1:
+ @perl -0777 -ne '$(_continued_string_col_1)' \
+ $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') \
+ || { echo '$(ME): continued string with word in first column' \
+ 1>&2; exit 1; } || :
+# Use this to list offending lines:
+# git ls-files |grep '\.[ch]$' | xargs \
+# perl -n -0777 -e 's/^usage.*?\n}//ms;/\\\n\w/ and print "$ARGV\n"' \
+# | xargs grep -A1 '\\$'|grep '\.[ch][:-][_a-zA-Z]'
+
+