[RFC 3/4] syntax-check: Ensure WITH_ macros are used correctly

Andrea Bolognani posted 4 patches 1 year, 11 months ago
[RFC 3/4] syntax-check: Ensure WITH_ macros are used correctly
Posted by Andrea Bolognani 1 year, 11 months ago
They are supposed to always be defined, with their value
reflecting the availability of the corresponding feature, so
using #ifdef or #if defined() with them is incorrect.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 build-aux/syntax-check.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 2ac8c5760f..067f47ac03 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -1347,6 +1347,11 @@ sc_rst_since:
 	halt='format :since: correctly' \
 	  $(_sc_search_regexp)
 
+sc_with_ifdef:
+	@prohibit='^# *(ifdef +|ifndef +|if.*defined\()WITH_' \
+	halt='do not use #ifdef or #if defined() for WITH_ macros' \
+	  $(_sc_search_regexp)
+
 
 ## ---------- ##
 ## Exceptions ##
-- 
2.43.2
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org