From 8b8afe81fe7dbda9cf1dea6c18a1b4d56e871c7e Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 7 Jan 2010 15:57:38 -0700 Subject: Address remaining 'make syntax-check' findings. * gnulib: Update to latest. * Makefile.am (tests/package.m4): Avoid @@ substitution. (src_m4_LDADD): Link with libiconv. * m4/m4private.h (STREQ): New macro. * m4/resyntax.c (m4_regexp_syntax_encode): Use it. * src/main.c (process_file): Likewise. (includes): Drop unused header. * m4/macro.c (m4_arg_equal): Adjust comment. * m4/syntax.c: Likewise. * m4/system_.h: Avoid useless preprocessor parenthesis. * ltdl/m4/stackovf.m4 (M4_SYS_STACKOVF): Likewise. * src/stackovf.c: Likewise. (setup_stackovf_trap): Mark diagnostics. * modules/mpeval.c (includes): Move quotearg.h inclusion... * modules/evalparse.c (includes): ...to where it is used. * cfg.mk (local-checks-to-skip): Exempt tests that cause spurious failures, but first fix what they were intended to detect. (_makefile_at_at_check_exceptions): Allow an exception. Signed-off-by: Eric Blake (cherry picked from commit 2f6096389e2047a01618419af3f4471735444520) --- ChangeLog | 22 ++++++++++++++++++++++ Makefile.am | 12 ++++++------ cfg.mk | 10 +++++++++- gnulib | 2 +- ltdl/m4/stackovf.m4 | 6 +++--- m4/m4private.h | 3 +++ m4/macro.c | 4 ++-- m4/resyntax.c | 2 +- m4/syntax.c | 2 +- m4/system_.h | 4 ++-- modules/evalparse.c | 2 ++ modules/mpeval.c | 2 -- src/main.c | 3 +-- src/stackovf.c | 12 ++++++------ 14 files changed, 59 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45744aa2..9faab841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2010-01-08 Eric Blake + + Address remaining 'make syntax-check' findings. + * gnulib: Update to latest. + * Makefile.am (tests/package.m4): Avoid @@ substitution. + (src_m4_LDADD): Link with libiconv. + * m4/m4private.h (STREQ): New macro. + * m4/resyntax.c (m4_regexp_syntax_encode): Use it. + * src/main.c (process_file): Likewise. + (includes): Drop unused header. + * m4/macro.c (m4_arg_equal): Adjust comment. + * m4/syntax.c: Likewise. + * m4/system_.h: Avoid useless preprocessor parenthesis. + * ltdl/m4/stackovf.m4 (M4_SYS_STACKOVF): Likewise. + * src/stackovf.c: Likewise. + (setup_stackovf_trap): Mark diagnostics. + * modules/mpeval.c (includes): Move quotearg.h inclusion... + * modules/evalparse.c (includes): ...to where it is used. + * cfg.mk (local-checks-to-skip): Exempt tests that cause spurious + failures, but first fix what they were intended to detect. + (_makefile_at_at_check_exceptions): Allow an exception. + 2010-01-07 Eric Blake Use correct license on auxiliary documentation. diff --git a/Makefile.am b/Makefile.am index ddffcff8..ecba57ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -102,7 +102,7 @@ src_m4_SOURCES += src/stackovf.c endif src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src src_m4_LDFLAGS = $(AM_LDFLAGS) $(DLPREOPEN) -src_m4_LDADD = m4/libm4.la +src_m4_LDADD = m4/libm4.la $(LTLIBICONV) src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la ## ## @@ -383,11 +383,11 @@ $(srcdir)/tests/package.m4: .version :; \ { \ echo '# Signature of the current package.'; \ - echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ - echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ - echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ - echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ - echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ + echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \ + echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \ + echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \ + echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \ } > $(srcdir)/tests/package.m4 tests/atconfig: config.status diff --git a/cfg.mk b/cfg.mk index e6616a04..25a02372 100644 --- a/cfg.mk +++ b/cfg.mk @@ -19,7 +19,15 @@ manual_title = GNU macro processor # Tests not to run as part of "make syntax-check". # M4 intentionally uses a coding style that compiles under C++. -local-checks-to-skip = sc_cast_of_x_alloc_return_value +# sc_proper_name_utf8_requires_ICONV doesn't work with non-recursive Makefile +# sc_po_check assumes a directory layout that we don't quite provide +local-checks-to-skip = sc_cast_of_x_alloc_return_value \ + sc_proper_name_utf8_requires_ICONV \ + sc_po_check + +# PRAGMA_SYSTEM_HEADER includes #, which does not work through a +# Makefile variable, so we exempt it. +_makefile_at_at_check_exceptions = ' && !/PRAGMA_SYSTEM_HEADER/' # Hash of NEWS contents, to ensure we don't add entries to wrong section. old_NEWS_hash = 0ef74b67f86e4f4ec20b67f02d9b1124 diff --git a/gnulib b/gnulib index c1a179cd..c535f448 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit c1a179cd48726257211e503550e1199da90c8465 +Subproject commit c535f4489b41f28afd115ae331d69595ea41b6a1 diff --git a/ltdl/m4/stackovf.m4 b/ltdl/m4/stackovf.m4 index 8b9232ef..3bf57ad2 100644 --- a/ltdl/m4/stackovf.m4 +++ b/ltdl/m4/stackovf.m4 @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# serial 6 +# serial 7 # M4_SYS_STACKOVF # --------------- @@ -49,8 +49,8 @@ if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then #include #include ]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r); -#if (!defined(HAVE_SIGACTION) || !defined(SA_ONSTACK)) \ - && (!defined(HAVE_SIGVEC) || !defined(SV_ONSTACK)) +#if (!defined HAVE_SIGACTION || !defined SA_ONSTACK) \ + && (!defined HAVE_SIGVEC || !defined SV_ONSTACK) choke me /* SA_ONSTACK and/or SV_ONSTACK are not defined */ #endif ]])], [M4_cv_use_stackovf=yes]) diff --git a/m4/m4private.h b/m4/m4private.h index 0ee10e24..f7b47f85 100644 --- a/m4/m4private.h +++ b/m4/m4private.h @@ -619,6 +619,9 @@ extern void m4__include_init (m4 *); casting away any const. */ #define DELETE(Expr) ((Expr) = (free ((void *) (Expr)), (void *) 0)) +/* Avoid negative logic when comparing two strings. */ +#define STREQ(a, b) (strcmp (a, b) == 0) + #if DEBUG # define DEBUG_INCL 1 diff --git a/m4/macro.c b/m4/macro.c index b88d5cbe..d4147819 100644 --- a/m4/macro.c +++ b/m4/macro.c @@ -1272,8 +1272,8 @@ m4_arg_text (m4 *context, m4_macro_args *argv, size_t arg, bool flatten) /* Given ARGV, compare text arguments INDEXA and INDEXB for equality. Both indices must be non-zero. Return true if the arguments contain the same contents; often more efficient than - !strcmp (m4_arg_text (context, argv, indexa), - m4_arg_text (context, argv, indexb)). */ + STREQ (m4_arg_text (context, argv, indexa), + m4_arg_text (context, argv, indexb)). */ bool m4_arg_equal (m4 *context, m4_macro_args *argv, size_t indexa, size_t indexb) { diff --git a/m4/resyntax.c b/m4/resyntax.c index 5e7b9701..6f6a379a 100644 --- a/m4/resyntax.c +++ b/m4/resyntax.c @@ -99,7 +99,7 @@ m4_regexp_syntax_encode (const char *spec) for (resyntax = m4_resyntax_map; resyntax->spec != NULL; ++resyntax) { - if (!strcmp (resyntax->spec, canonical)) + if (STREQ (resyntax->spec, canonical)) break; } diff --git a/m4/syntax.c b/m4/syntax.c index 9e8cf42e..792a97f9 100644 --- a/m4/syntax.c +++ b/m4/syntax.c @@ -63,7 +63,7 @@ will not show up in the syntax-table. Having a syntax table allows new facilities. The new builtin - "changesyntax" allows the the user to change the category of any + "changesyntax" allows the user to change the category of any character. By default, '\n' is both ECOMM and SPACE, depending on the context. diff --git a/m4/system_.h b/m4/system_.h index 458c2ffb..aa28247b 100644 --- a/m4/system_.h +++ b/m4/system_.h @@ -114,11 +114,11 @@ BEGIN_C_DECLS a way sympathetic to the compiler to maximise optimization. */ #undef M4_STMT_START #undef M4_STMT_END -#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) +#if defined __GNUC__ && !defined __STRICT_ANSI__ && !defined __cplusplus # define M4_STMT_START (void)( # define M4_STMT_END ) #else -# if (defined (sun) || defined (__sun__)) +# if defined sun || defined __sun__ # define M4_STMT_START if (1) # define M4_STMT_END else (void)0 # else diff --git a/modules/evalparse.c b/modules/evalparse.c index 3ed29d74..574541e6 100644 --- a/modules/evalparse.c +++ b/modules/evalparse.c @@ -35,6 +35,8 @@ both `eval' and `mpeval', but which is redefined appropriately when this file is #included into its clients. */ +#include "quotearg.h" + typedef enum eval_token { ERROR, BADOP, diff --git a/modules/mpeval.c b/modules/mpeval.c index 44a0d3d0..ae620cbc 100644 --- a/modules/mpeval.c +++ b/modules/mpeval.c @@ -32,8 +32,6 @@ # include #endif -#include "quotearg.h" - /* Rename exported symbols for dlpreload()ing. */ #define m4_builtin_table mpeval_LTX_m4_builtin_table #define m4_macro_table mpeval_LTX_m4_macro_table diff --git a/src/main.c b/src/main.c index e9f2599b..240e241d 100644 --- a/src/main.c +++ b/src/main.c @@ -26,7 +26,6 @@ #include "m4.h" -#include "close-stream.h" #include "closein.h" #include "configmake.h" #include "getopt.h" @@ -302,7 +301,7 @@ size_opt (char const *opt, int oi, int optchar) static void process_file (m4 *context, const char *name) { - if (strcmp (name, "-") == 0) + if (STREQ (name, "-")) /* TRANSLATORS: This is a short name for `standard input', used when a command line file was given as `-'. */ m4_push_file (context, stdin, _("stdin"), false); diff --git a/src/stackovf.c b/src/stackovf.c index 95a5c3a2..fb2aa1a5 100644 --- a/src/stackovf.c +++ b/src/stackovf.c @@ -118,7 +118,7 @@ typedef void (*handler_t) (void); -#if defined(__ultrix) && defined(__vax) +#if defined __ultrix && defined __vax extern char *sbrk (int); extern int getrlimit (int, struct rlimit *); extern int sigstack (struct sigstack *, struct sigstack *); @@ -313,7 +313,7 @@ Error - Do not know how to set up stack-ovf trap handler... /* Calculate the approximate expected addr for a stack-ovf trap. */ if (getrlimit (RLIMIT_STACK, &rl) < 0) - error (EXIT_FAILURE, errno, "getrlimit"); + error (EXIT_FAILURE, errno, _("getrlimit")); stack_len = (rl.rlim_cur < rl.rlim_max ? rl.rlim_cur : rl.rlim_max); stackbot = (char *) argv; grows_upward = ((char *) &stack_len > stackbot); @@ -386,7 +386,7 @@ Error - Do not know how to set up stack-ovf trap handler... free (stackbuf); if (errno == ENOSYS) return; - error (EXIT_FAILURE, errno, "sigaltstack"); + error (EXIT_FAILURE, errno, _("sigaltstack")); } } @@ -408,7 +408,7 @@ Error - Do not know how to set up stack-ovf trap handler... free (stackbuf); if (errno == ENOSYS) return; - error (EXIT_FAILURE, errno, "sigstack"); + error (EXIT_FAILURE, errno, _("sigstack")); } } @@ -431,7 +431,7 @@ Error - Do not know how to set up stack-ovf trap handler... sigemptyset (&act.sa_mask); act.sa_flags = (SA_ONSTACK | SA_RESETHAND | SA_SIGINFO); if (sigaction (SIGSEGV, &act, NULL) < 0) - error (EXIT_FAILURE, errno, "sigaction"); + error (EXIT_FAILURE, errno, _("sigaction")); #else /* ! HAVE_SIGACTION */ @@ -439,7 +439,7 @@ Error - Do not know how to set up stack-ovf trap handler... vec.sv_mask = 0; vec.sv_flags = (SV_ONSTACK | SV_RESETHAND); if (sigvec (SIGSEGV, &vec, NULL) < 0) - error (EXIT_FAILURE, errno, "sigvec"); + error (EXIT_FAILURE, errno, _("sigvec")); #endif /* ! HAVE_SIGACTION */ -- cgit v1.2.1