[libvirt] [PATCH] build: enforce preprocessor indentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since cppi is not part of Fedora Core 12, the check is conditional:
without cppi, running 'make syntax-check' merely warns:

$ make sc_preprocessor_indentation
preprocessor_indentation
maint.mk: skipping test sc_preprocessor_indentation: cppi not installed

* cfg.mk (sc_preprocessor_indentation): New syntax-check rule.
(preprocessor_exempt): New macro, with first exemption.
---

As promised, here's a better version of 2/2; I see that 1/2 is
now already committed.

 cfg.mk |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 680c312..8b89cd2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -251,6 +251,19 @@ sc_prohibit_trailing_blank_lines:
 	rm -f $@-t;							\
 	test $$found = 0

+# Regex for grep -E that exempts generated files from style rules.
+preprocessor_exempt = (remote_(driver|protocol)\.h)$$
+# Enforce recommended preprocessor indentation style.
+sc_preprocessor_indentation:
+	@if (cppi --version >/dev/null 2>&1); then			\
+	  $(VC_LIST_EXCEPT) | grep '\.[ch]$$'				\
+	    | grep -vE '$(preprocessor_exempt)' | xargs cppi -a -c	\
+	    || { echo '$(ME): incorrect preprocessor indentation' 1>&2;	\
+		exit 1; };						\
+	else								\
+	  echo '$(ME): skipping test $@: cppi not installed' 1>&2;	\
+	fi
+
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null

-- 
1.6.6.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]