Add syntax check rule to look for non-reentrant POSIX apis

This commit is contained in:
Daniel P. Berrange
2009-01-20 20:19:55 +00:00
parent 3548e9aae8
commit 071be08079
5 changed files with 107 additions and 0 deletions
+11
View File
@@ -13,6 +13,8 @@ VC_LIST = $(srcdir)/build-aux/vc-list-files
VC_LIST_EXCEPT = \
$(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
include Makefile.nonreentrant
# Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
@@ -111,6 +113,15 @@ sc_prohibit_asprintf:
@grep -nE '\<[a]sprintf\>' $$($(VC_LIST_EXCEPT)) && \
{ echo '$(ME): use virAsprintf, not a'sprintf 1>&2; exit 1; } || :
sc_prohibit_nonreentrant:
@fail=0 ; \
for i in $(NON_REENTRANT) ; \
do \
grep -nE "\<$$i\>[:space:]*\(" $$($(VC_LIST_EXCEPT)) && \
fail=1 && echo "$(ME): use $${i}_r, not $${i}" || : ; \
done ; \
exit $$fail
# Using EXIT_SUCCESS as the first argument to error is misleading,
# since when that parameter is 0, error does not exit. Use `0' instead.
sc_error_exit_success: