On 11/12/2010 12:26 AM, Jim Meyering wrote: > Eric Blake wrote: >> * top/maint.mk (sc_bindtextdomain): Check for evidence that _() >> will likely work. >> >> I recently debugged a situation in libvirt where a program had >> not set up the i18n framework, therefore calls to _() were doing >> nothing. If this rule had been in place, I would have quickly >> detected that main() was not properly initializing gettext >> during 'make syntax-check'.
I suppose I could also check for the setlocale() call, or even both of
them, but I'm not sure it's worth the complexity for doing a multi-line
grep.
>> +sc_bindtextdomain:
>> + @require='bindtextdomain *\(' \
>> + in_vc_files='\.c$$' \
>> + containing='\<main *(' \
>> + halt='the above files do not call bindtextdomain' \
>> + $(_sc_search_regexp)
>
> I was going to suggest making the 'require'd regexp
> configurable, in case someone wraps initialization
> code like that in a helper function. Then they
> could require their initialization function instead.
>
> But this might count as pre-optimization.
> I.e., perhaps no gnulib-using client does that.
> At worst, we can wait until someone who does such
> a thing complains about their false positives.
Sounds reasonable to me. With that, I've pushed it to gnulib.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
