From cbecb8cab8ed0228acb4d86d2a0b1ffa6d7977fc Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 26 Dec 2008 15:33:34 +0100 Subject: [PATCH] maint: tighten m4 AC_ quoting check * maint.mk (sc_m4_quote_check): Renamed from m4-check. Also search for AC_DEFINE and AC_DEFINE_UNQUOTED. Also search in configure.ac. * configure.ac: Quote first argument of AC_DEFINE. * jm-macros.m4 (coreutils_MACROS): Quote the first argument to AC_DEFINE. --- configure.ac | 16 ++++++++-------- m4/jm-macros.m4 | 4 ++-- maint.mk | 9 +++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index f165893a0..4a77c8b3c 100644 --- a/configure.ac +++ b/configure.ac @@ -133,7 +133,7 @@ else fi])dnl AC_MSG_RESULT($utils_cv_localtime_cache) if test $utils_cv_localtime_cache = yes; then - AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME]) + AC_DEFINE([LOCALTIME_CACHE], 1, [FIXME]) fi # SCO-ODT-3.0 is reported to need -los to link programs using initgroups @@ -146,7 +146,7 @@ AC_CHECK_FUNCS(syslog) if test $ac_cv_func_syslog = no; then # syslog is not in the default libraries. See if it's in some other. for lib in bsd socket inet; do - AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME]) + AC_CHECK_LIB($lib, syslog, [AC_DEFINE([HAVE_SYSLOG], 1, [FIXME]) LIBS="$LIBS -l$lib"; break]) done fi @@ -189,7 +189,7 @@ AC_CACHE_VAL(su_cv_func_ut_host_in_utmp, AC_MSG_RESULT($su_cv_func_ut_host_in_utmp) if test $su_cv_func_ut_host_in_utmp = yes; then have_ut_host=1 - AC_DEFINE(HAVE_UT_HOST, 1, [FIXME]) + AC_DEFINE([HAVE_UT_HOST], 1, [FIXME]) fi if test -z "$have_ut_host"; then @@ -201,8 +201,8 @@ if test -z "$have_ut_host"; then [su_cv_func_ut_host_in_utmpx=no])]) AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx) if test $su_cv_func_ut_host_in_utmpx = yes; then - AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME]) - AC_DEFINE(HAVE_UT_HOST, 1, [FIXME]) + AC_DEFINE([HAVE_UTMPX_H], 1, [FIXME]) + AC_DEFINE([HAVE_UT_HOST], 1, [FIXME]) fi fi @@ -228,7 +228,7 @@ yes su_cv_sys_termios_needs_xopen_source=no))]) AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source) test $su_cv_sys_termios_needs_xopen_source = yes && - AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME]) + AC_DEFINE([TERMIOS_NEEDS_XOPEN_SOURCE], 1, [FIXME]) AC_MSG_CHECKING(c_line in struct termios) AC_CACHE_VAL(su_cv_sys_c_line_in_termios, @@ -241,7 +241,7 @@ yes [su_cv_sys_c_line_in_termios=no])]) AC_MSG_RESULT($su_cv_sys_c_line_in_termios) test $su_cv_sys_c_line_in_termios = yes \ - && AC_DEFINE(HAVE_C_LINE, 1, [FIXME]) + && AC_DEFINE([HAVE_C_LINE], 1, [FIXME]) fi # FIXME: note that this macro appears above, too. @@ -267,7 +267,7 @@ if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \ AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h) test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \ - && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1, + && AC_DEFINE([GWINSZ_IN_SYS_PTY], 1, [Define if your system defines TIOCGWINSZ in sys/pty.h.]) fi diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4 index a53be5b38..38e19fcb5 100644 --- a/m4/jm-macros.m4 +++ b/m4/jm-macros.m4 @@ -36,9 +36,9 @@ AC_DEFUN([coreutils_MACROS], AC_REQUIRE([AC_FUNC_FSEEKO]) # By default, argmatch should fail calling usage (1). - AC_DEFINE(ARGMATCH_DIE, [usage (1)], + AC_DEFINE([ARGMATCH_DIE], [usage (1)], [Define to the function xargmatch calls on failures.]) - AC_DEFINE(ARGMATCH_DIE_DECL, [void usage (int _e)], + AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)], [Define to the declaration of the xargmatch failure function.]) # used by ls diff --git a/maint.mk b/maint.mk index 3efcd8fe5..9ae8cdad8 100644 --- a/maint.mk +++ b/maint.mk @@ -74,7 +74,7 @@ syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' \ .PHONY: $(syntax-check-rules) local-checks-available = \ - po-check copyright-check m4-check author_mark_check \ + po-check copyright-check author_mark_check \ patch-check $(syntax-check-rules) \ makefile_path_separator_check \ makefile-check check-AUTHORS @@ -473,9 +473,10 @@ changelog-check: exit 1; \ fi -m4-check: - @grep -n 'AC_DEFUN([^[]' m4/*.m4 \ - && { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \ +sc_m4_quote_check: + @grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \ + $$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \ + && { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \ exit 1; } || : fix_po_file_diag = \