[PATCH 0/6] Remove few useless syntax-checks

Peter Krempa (6): syntax-check: Remove check for proper spelling of 'Red Hat' syntax-check: Clean up check for g_auto* syntax-check: Remove used header checks for gnulib modules syntax-check: Remove check for prohibited 'WITH_MBRTOWC' syntax-check: Remove unused header check for 'strings.h' syntax-check: Remove GFDL format check build-aux/syntax-check.mk | 134 +------------------------------------- 1 file changed, 1 insertion(+), 133 deletions(-) -- 2.29.2

Don't single out this one, and also don't waste computational resources on it. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- build-aux/syntax-check.mk | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 51a498a897..1dac418008 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -793,18 +793,6 @@ sc_prohibit_long_lines: halt='Wrap long lines in expected output files' \ $(_sc_search_regexp) -sc_copyright_format: - @require='Copyright .*Red 'Hat', Inc\.' \ - containing='Copyright .*Red 'Hat \ - halt='Red Hat copyright is missing Inc.' \ - $(_sc_search_regexp) - @prohibit='Copyright [^(].*Red 'Hat \ - halt='consistently use (C) in Red Hat copyright' \ - $(_sc_search_regexp) - @prohibit='\<RedHat\>' \ - halt='spell Red Hat as two words' \ - $(_sc_search_regexp) - # Prefer the new URL listing over the old street address listing when # calling out where to get a copy of the [L]GPL. Also, while we have # to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any @@ -1878,9 +1866,6 @@ exclude_file_name_regexp--sc_bindtextdomain = .* exclude_file_name_regexp--sc_gettext_init = ^((tests|examples)/|tools/virt-login-shell.c|src/util/vireventglib\.c) -exclude_file_name_regexp--sc_copyright_format = \ - ^build-aux/syntax-check\.mk$$ - exclude_file_name_regexp--sc_copyright_usage = \ ^COPYING(|\.LESSER)|build-aux/syntax-check.mk$$ -- 2.29.2

Remove the old libvirt variants that are no longer in use and include g_autostringlist. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- build-aux/syntax-check.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 1dac418008..b03441d4cd 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -1115,7 +1115,7 @@ sc_prohibit_backslash_alignment: # Rule to ensure that variables declared using a cleanup macro are # always initialized. sc_require_attribute_cleanup_initialization: - @prohibit='((g_auto(ptr|free)?)|(VIR_AUTO((FREE|PTR|UNREF|CLEAN)\(.+\)|CLOSE|STRINGLIST))) *[^=]+;' \ + @prohibit='((g_auto(ptr|free|slist)?)|VIR_AUTOCLOSE)) *[^=]+;' \ in_vc_files='\.[chx]$$' \ halt='variable declared with a cleanup macro must be initialized' \ $(_sc_search_regexp) -- 2.29.2

We removed gnulib support, so all the checks whether a header is included only when it's used are pointless now. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- build-aux/syntax-check.mk | 96 --------------------------------------- 1 file changed, 96 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index b03441d4cd..c1134d6a02 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -1415,97 +1415,10 @@ endef sc_prohibit_assert_without_use: @h='assert.h' re='\<assert *\(' $(_sc_header_without_use) -# Prohibit the inclusion of close-stream.h without an actual use. -sc_prohibit_close_stream_without_use: - @h='close-stream.h' re='\<close_stream *\(' $(_sc_header_without_use) - # Prohibit the inclusion of getopt.h without an actual use. sc_prohibit_getopt_without_use: @h='getopt.h' re='\<getopt(_long)? *\(' $(_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) *\(' \ - $(_sc_header_without_use) - -# Don't include this header unless you use one of its functions. -sc_prohibit_inttostr_without_use: - @h='inttostr.h' re='\<(off|[iu]max|uint)tostr *\(' \ - $(_sc_header_without_use) - -# Don't include this header unless you use one of its functions. -sc_prohibit_ignore_value_without_use: - @h='ignore-value.h' re='\<ignore_(value|ptr) *\(' \ - $(_sc_header_without_use) - -# Don't include this header unless you use one of its functions. -sc_prohibit_error_without_use: - @h='error.h' \ - re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\ - $(_sc_header_without_use) - -# Don't include xalloc.h unless you use one of its functions. -# Consider these symbols: -# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__'; -# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/xalloc.h -# Divide into two sets on case, and filter each through this: -# | sort | perl -MRegexp::Assemble -le \ -# 'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 's/\?://g' -# Note this was produced by the above: -# _xa1 = \ -#x(((2n?)?re|c(har)?|n(re|m)|z)alloc|alloc_(oversized|die)|m(alloc|emdup)|strdup) -# But we can do better, in at least two ways: -# 1) take advantage of two "dup"-suffixed strings: -# x(((2n?)?re|c(har)?|n(re|m)|[mz])alloc|alloc_(oversized|die)|(mem|str)dup) -# 2) notice that "c(har)?|[mz]" is equivalent to the shorter and more readable -# "char|[cmz]" -# x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup) -_xa1 = x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup) -_xa2 = X([CZ]|N?M)ALLOC -sc_prohibit_xalloc_without_use: - @h='xalloc.h' \ - re='\<($(_xa1)|$(_xa2)) *\('\ - $(_sc_header_without_use) - -sc_prohibit_cloexec_without_use: - @h='cloexec.h' re='\<(set_cloexec_flag|dup_cloexec) *\(' \ - $(_sc_header_without_use) - -sc_prohibit_posixver_without_use: - @h='posixver.h' re='\<posix2_version *\(' $(_sc_header_without_use) - -sc_prohibit_same_without_use: - @h='same.h' re='\<same_name(at)? *\(' $(_sc_header_without_use) - -sc_prohibit_hash_pjw_without_use: - @h='hash-pjw.h' \ - re='\<hash_pjw\>' \ - $(_sc_header_without_use) - -sc_prohibit_safe_read_without_use: - @h='safe-read.h' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \ - $(_sc_header_without_use) - -sc_prohibit_argmatch_without_use: - @h='argmatch.h' \ - re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<(invalid_arg|argmatch(_exit_fn|_(in)?valid)?) *\()' \ - $(_sc_header_without_use) - -sc_prohibit_canonicalize_without_use: - @h='canonicalize.h' \ - re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode|file_name)' \ - $(_sc_header_without_use) - -sc_prohibit_root_dev_ino_without_use: - @h='root-dev-ino.h' \ - re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \ - $(_sc_header_without_use) - -sc_prohibit_openat_without_use: - @h='openat.h' \ - re='\<(openat_(permissive|needs_fchdir|(save|restore)_fail)|l?(stat|ch(own|mod))at|(euid)?accessat|(FCHMOD|FCHOWN|STAT)AT_INLINE)\>' \ - $(_sc_header_without_use) - # The following list was generated by running: # man signal.h|col -b|perl -ne '/bsd_signal.*;/.../sigwaitinfo.*;/ and print' \ # | perl -lne '/^\s+(?:int|void).*?(\w+).*/ and print $1' | fmt @@ -1546,11 +1459,6 @@ sc_prohibit_stdio--_without_use: @h='stdio--.h' re='\<((f(re)?|p)open|tmpfile) *\(' \ $(_sc_header_without_use) -# Don't include stdio-safer.h unless you use one of its functions. -sc_prohibit_stdio-safer_without_use: - @h='stdio-safer.h' re='\<((f(re)?|p)open|tmpfile)_safer *\(' \ - $(_sc_header_without_use) - # Prohibit the inclusion of strings.h without a sensible use. # Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible. sc_prohibit_strings_without_use: @@ -1576,10 +1484,6 @@ sc_prohibit_dirent_without_use: re='\<($(_dirent_syms_re))\>' \ $(_sc_header_without_use) -# Don't include xfreopen.h unless you use one of its functions. -sc_prohibit_xfreopen_without_use: - @h='xfreopen.h' re='\<xfreopen *\(' $(_sc_header_without_use) - # Ensure that each .c file containing a "main" function also # calls bindtextdomain. sc_bindtextdomain: -- 2.29.2

While our code uses mbrtowc, we don't do any detection of it. Additionally it was recently changed from HAVE_MBRTOWC to WITH_MBRTOWC so even if it came from an included file it would no longer work. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- build-aux/syntax-check.mk | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index c1134d6a02..8f8d0ec6ab 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -1390,11 +1390,6 @@ sc_require_config_h_first: else :; \ fi -sc_prohibit_WITH_MBRTOWC: - @prohibit='\bWITH_MBRTOWC\b' \ - halt="do not use $$prohibit; it is always defined" \ - $(_sc_search_regexp) - # To use this "command" macro, you must first define two shell variables: # h: the header name, with no enclosing <> or "" # re: a regular expression that matches IFF something provided by $h is used. -- 2.29.2

Libvirt doesn't use it and we also require use of wrappers for such string operations. Remove the pointless check. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- build-aux/syntax-check.mk | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 8f8d0ec6ab..dbc0338ac0 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -1454,14 +1454,6 @@ sc_prohibit_stdio--_without_use: @h='stdio--.h' re='\<((f(re)?|p)open|tmpfile) *\(' \ $(_sc_header_without_use) -# Prohibit the inclusion of strings.h without a sensible use. -# Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible. -sc_prohibit_strings_without_use: - @h='strings.h' \ - re='\<(strn?casecmp|ffs(ll)?)\>' \ - $(_sc_header_without_use) - - _stddef_syms_re = NULL|offsetof|ptrdiff_t|size_t|wchar_t # Prohibit the inclusion of stddef.h without an actual use. sc_prohibit_stddef_without_use: -- 2.29.2

Our docs don't use the GFDL so checking its format is pointless. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- build-aux/syntax-check.mk | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index dbc0338ac0..6d934c4de1 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -1513,14 +1513,6 @@ sc_prohibit_backup_files: { echo '$(ME): found version controlled backup file' 1>&2; \ exit 1; } || : -# 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) -sc_GFDL_version: - @prohibit='$(_GFDL_regexp)' \ - halt='GFDL vN, N!=3' \ - $(_sc_search_regexp) - # This Perl code is slightly obfuscated. Not only is each "$" doubled # because it's in a Makefile, but the $$c's are comments; we cannot # use "#" due to the way the script ends up concatenated onto one line. -- 2.29.2

On a Wednesday in 2021, Peter Krempa wrote:
Peter Krempa (6): syntax-check: Remove check for proper spelling of 'Red Hat' syntax-check: Clean up check for g_auto* syntax-check: Remove used header checks for gnulib modules syntax-check: Remove check for prohibited 'WITH_MBRTOWC' syntax-check: Remove unused header check for 'strings.h' syntax-check: Remove GFDL format check
build-aux/syntax-check.mk | 134 +------------------------------------- 1 file changed, 1 insertion(+), 133 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Peter Krempa