summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2017-09-11 09:43:12 +0100
committerFrediano Ziglio <freddy77@gmail.com>2023-11-22 07:38:54 +0000
commitb228dc9f44cd7a6875dffff5e37e51700ae911f8 (patch)
tree1b91030f81b01377970f3e132beb9ca5d16b6efb
parentfe1c25f530b95d32cc81bc1a395d80ace631d2dd (diff)
syntax-check: Check ENABLE_EXTRA_CHECKS is not used incorrectly
Usually configuration macros are defined to 0 or undefined. For this reason these macros are sometimes checked using #if and sometimes with #ifndef/#ifdef. As this macro is always defined with 0 or 1 it makes no sense to check if defined or not so check the code to avoid this mistake. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--cfg.mk8
1 files changed, 8 insertions, 0 deletions
diff --git a/cfg.mk b/cfg.mk
index ee291c9e..dedfcb6c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -111,6 +111,14 @@ sc_copyright_format:
halt='spell Red Hat as two words' \
$(_sc_search_regexp)
+# ENABLE_EXTRA_CHECKS is always defined, do not allow
+# "#ifndef ENABLE_EXTRA_CHECKS"
+sc_extra_checks:
+ @prohibit='#[[:space:]]*ifn?def[[:space:]]+ENABLE_EXTRA_CHECKS' \
+ in_vc_files='\.[ch]$$' \
+ halt='ENABLE_EXTRA_CHECKS is always defined' \
+ $(_sc_search_regexp)
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null