[PATCH 5/6] syntax-check: Don't include duplicate header

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

 



---
 cfg.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/cfg.mk b/cfg.mk
index 394521e..9cf4cff 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -722,6 +722,20 @@ sc_prohibit_exit_in_tests:
 	halt='use return, not exit(), in tests'				\
 	  $(_sc_search_regexp)
 
+# Don't include duplidate header in the source (either *.c or *.h)
+sc_prohibit_duplicate_header:
+	@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then	\
+	  for i in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do		\
+	    for j in $$(grep '^# *include.*\.h' $$i			\
+	      | awk -F' ' '{print $$NF}'); do				\
+	      test $$(grep "^# *include $$j" $$i | wc -l) -gt 1 &&	\
+		{ echo '$(ME): Duplidate header '$$j' in '$$i'' 1>&2;	\
+		  exit 1; } || :;					\
+	    done;							\
+	  done;								\
+	else :;								\
+	fi
+
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null
 
-- 
1.8.1.4

--
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]