In diffutils I wanted to check for unmarked diagnostics emitted by functions other than "error" (the name hard-coded into the sc_unmarked_diagnostics rule). I've generalized that rule so now diffutils can do this:
_gl_translatable_diag_func_re = (error|(perror_)?fatal|pfatal_with_name) With that, the new sc_unmarked_diagnostics rule found 35 unmarked diagnostics. >From 33b95ee0afed91f941fccd71252c8b2e72ae4544 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 4 Jun 2011 19:56:58 +0200 Subject: [PATCH] maint.mk: sc_unmarked_diagnostics: don't hard-code "error" * top/maint.mk (sc_unmarked_diagnostics): Don't hard-code the function name, "error". (_gl_translatable_diag_func_re): New configurable variable. --- ChangeLog | 7 +++++++ top/maint.mk | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index b38b724..cdc4f06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-06-04 Jim Meyering <meyer...@redhat.com> + + maint.mk: sc_unmarked_diagnostics: don't hard-code "error" + * top/maint.mk (sc_unmarked_diagnostics): Don't hard-code the + function name, "error". + (_gl_translatable_diag_func_re): New configurable variable. + 2011-06-04 Bruno Haible <br...@clisp.org> getopt: Avoid gcc warning. diff --git a/top/maint.mk b/top/maint.mk index c55571c..6f6b8be 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -684,11 +684,16 @@ sc_two_space_separator_in_usage: halt='help2man requires at least two spaces between an option and its description'\ $(_sc_search_regexp) +# A regexp matching function names like "error" that may be used +# to emit translatable messages. +_gl_translatable_diag_func_re ?= error + # Look for diagnostics that aren't marked for translation. # This won't find any for which error's format string is on a separate line. sc_unmarked_diagnostics: @grep -nE \ - '\<error *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \ + '\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \ + $$($(VC_LIST_EXCEPT)) \ | grep -Ev '(_|ngettext ?)\(' && \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ exit 1; } || : -- 1.7.6.rc0.254.gf37de