diff --git a/Makefile.nonreentrant b/Makefile.nonreentrant index 78e26e31a8..5cc64c0d50 100644 --- a/Makefile.nonreentrant +++ b/Makefile.nonreentrant @@ -113,3 +113,11 @@ NON_REENTRANT += inet_nsap_ntoa NON_REENTRANT += inet_ntoa NON_REENTRANT += inet_ntop NON_REENTRANT += inet_pton + +# Separate two nothings by space to get one space in a variable +space = +space += +# The space needs to be in a variable otherwise it would be ignored. +# And there must be no spaces around the commas because they would +# not be ignored, logically. +NON_REENTRANT_RE=$(subst $(space),|,$(NON_REENTRANT)) diff --git a/cfg.mk b/cfg.mk index 2939458379..d75ae0e216 100644 --- a/cfg.mk +++ b/cfg.mk @@ -440,18 +440,11 @@ sc_prohibit_PATH_MAX: halt='dynamically allocate paths, do not use PATH_MAX' \ $(_sc_search_regexp) -# Use a subshell for each function, to give the optimal warning message. include $(srcdir)/Makefile.nonreentrant sc_prohibit_nonreentrant: - @fail=0 ; \ - for i in $(NON_REENTRANT) ; \ - do \ - (prohibit="\\<$$i *\\(" \ - halt="use $${i}_r, not $$i" \ - $(_sc_search_regexp) \ - ) || fail=1; \ - done ; \ - exit $$fail + @prohibit="\\<(${NON_REENTRANT_RE}) *\\(" \ + halt="use re-entrant functions (usually ending with _r)" \ + $(_sc_search_regexp) sc_prohibit_select: @prohibit='\