mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
cfg.mk: use a single regex for all non-reentrant functions
The prohibit_nonreentrant syntax-check rule spawns a new shell for every non-reentrant function we know, to make it easier to mention the function name in the error message, with the _r appended. Since the line with the offending function is already printed and some of the functions on our list do not have a _r counterpart, compile them into one big regex and use a more generic error message to save time.
This commit is contained in:
parent
e347e732bb
commit
e26098a1f4
@ -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))
|
||||
|
13
cfg.mk
13
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='\<select *\(' \
|
||||
|
Loading…
Reference in New Issue
Block a user