From aef5feaf109fa88968c9e1c78754e20386c4b96a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 19 Aug 2014 08:59:38 -0700 Subject: [PATCH] maint: enable more syntax checks * cfg.mk (local-checks-to-skip): Remove several rule names from this list, thus enabling the corresponding checks. To fix some, I made syntactic changes to source files. In other cases, I exempted certain files from the checks. Add exemptions for these: sc_prohibit_atoi_atof = ^(gzip|sample/sub)\.c$$ sc_space_tab = ^lib/match\.c$$ sc_useless_cpp_parens = ^(lib/match\.c|tailor\.h)$$ * configure.ac: Add quotes to fix under-quoting. * deflate.c: Remove unnecessary cpp parentheses. * tests/Makefile.am (TEST_ENVIRONMENT): Remove space-before-TAB. * unlzw.c: Change some TABs to spaces. --- cfg.mk | 13 ++++--------- configure.ac | 2 +- deflate.c | 4 ++-- tests/Makefile.am | 2 +- unlzw.c | 10 +++++----- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/cfg.mk b/cfg.mk index b2dc613..4321e64 100644 --- a/cfg.mk +++ b/cfg.mk @@ -22,16 +22,8 @@ local-checks-to-skip = \ sc_bindtextdomain \ sc_error_message_period \ sc_error_message_uppercase \ - sc_m4_quote_check \ - sc_obsolete_symbols \ sc_program_name \ - sc_prohibit_S_IS_definition \ - sc_prohibit_atoi_atof \ - sc_prohibit_stat_st_blocks \ - sc_space_tab \ - sc_texinfo_acronym \ - sc_useless_cpp_parens - + sc_texinfo_acronym # Tools used to bootstrap this package, used for "announcement". bootstrap-tools = autoconf,automake,gnulib @@ -75,6 +67,9 @@ exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \ ^tests/hufts-segv\.gz$$ exclude_file_name_regexp--sc_prohibit_strcmp = ^gzip\.c$$ exclude_file_name_regexp--sc_prohibit_always-defined_macros = ^tailor\.h$$ +exclude_file_name_regexp--sc_prohibit_atoi_atof = ^(gzip|sample/sub)\.c$$ +exclude_file_name_regexp--sc_space_tab = ^lib/match\.c$$ +exclude_file_name_regexp--sc_useless_cpp_parens = ^(lib/match\.c|tailor\.h)$$ exclude_file_name_regexp--sc_prohibit_double_semicolon = ^lib/match\.c$$ diff --git a/configure.ac b/configure.ac index 0c15e17..203e371 100644 --- a/configure.ac +++ b/configure.ac @@ -228,7 +228,7 @@ AC_CACHE_CHECK([for an assembler syntax supported by this package], rm -f conftest* _match.i _match.S match_.s match_.$OBJEXT;; esac]) if test "$gzip_cv_assembler" != no; then - AC_DEFINE(ASMV, , + AC_DEFINE([ASMV], , [Define if an assembler version of longest_match is available.]) AC_LIBOBJ(match) fi diff --git a/deflate.c b/deflate.c index 8a257f3..2a0316b 100644 --- a/deflate.c +++ b/deflate.c @@ -307,7 +307,7 @@ void lm_init (pack_level, flags) compr_level = pack_level; /* Initialize the hash table. */ -#if defined(MAXSEG_64K) && HASH_BITS == 15 +#if defined MAXSEG_64K && HASH_BITS == 15 for (j = 0; j < HASH_SIZE; j++) head[j] = NIL; #else memzero((char*)head, HASH_SIZE*sizeof(*head)); @@ -414,7 +414,7 @@ longest_match(IPos cur_match) /* Skip to next match if the match length cannot increase * or if the match length is less than 2: */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) +#if defined UNALIGNED_OK && MAX_MATCH == 258 /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ diff --git a/tests/Makefile.am b/tests/Makefile.am index d1e934e..2585184 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -72,7 +72,7 @@ TESTS_ENVIRONMENT = \ fi; \ }; \ LC_ALL=C; export LC_ALL; \ - VERSION=$(VERSION); export VERSION; \ + VERSION=$(VERSION); export VERSION; \ abs_top_builddir='$(abs_top_builddir)'; export abs_top_builddir; \ abs_top_srcdir='$(abs_top_srcdir)'; export abs_top_srcdir; \ abs_srcdir='$(abs_srcdir)'; export abs_srcdir; \ diff --git a/unlzw.c b/unlzw.c index 676d58c..867c0ea 100644 --- a/unlzw.c +++ b/unlzw.c @@ -16,11 +16,11 @@ #include "gzip.h" #include "lzw.h" -typedef unsigned char char_type; -typedef long code_int; -typedef unsigned long count_int; -typedef unsigned short count_short; -typedef unsigned long cmp_code_int; +typedef unsigned char char_type; +typedef long code_int; +typedef unsigned long count_int; +typedef unsigned short count_short; +typedef unsigned long cmp_code_int; #define MAXCODE(n) (1L << (n)) -- 2.47.2