[libvirt] [PATCH] cfg.mk: Introduce rule for setlocale()
Eric Blake
eblake at redhat.com
Wed Jun 4 16:21:55 UTC 2014
On 06/04/2014 03:15 AM, Martin Kletzander wrote:
> On Wed, Jun 04, 2014 at 10:59:08AM +0200, Michal Privoznik wrote:
>> In the past we had some issues where setlocale() was called without
>> corresponding include of locale.h. While on some systems this may
>> work, on others the compilation failed. We should have a syntax-check
>> rule for that to prevent this from happening again.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>> cfg.mk | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> +# Require #include <locale.h> in all files that call setlocale()
>> +sc_require_locale_h:
>> + @for i in $$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); do \
>> + if test -z "$$(grep setlocale $$i)" ; then continue; fi; \
>
> Why not:
>
> if ! grep -q setlocale $$i; then continue; fi
Even simpler, let maint.mk do it for you:
sc_require_locale_h:
@require='include.*locale\.h' \
containing='setlocale *(' \
halt='setlocale() requires <locale.h>' \
$(_sc_search_regexp)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140604/8f494b18/attachment-0001.sig>
More information about the libvir-list
mailing list