Except gnulib... --- cfg.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cfg.mk b/cfg.mk index e60c4e3..71f7ee4 100644 --- a/cfg.mk +++ b/cfg.mk @@ -722,6 +722,28 @@ sc_prohibit_exit_in_tests: halt='use return, not exit(), in tests' \ $(_sc_search_regexp) +# Don't include duplicate header in the source (either *.c or *.h) +sc_prohibit_duplicate_header: + @for i in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \ + awk 'BEGIN { \ + FS=" "; \ + fail=0; \ + } \ + /^# *include.*\.h[">]$$/ { \ + arr[$$NF]++; \ + } \ + END { \ + for (key in arr) { \ + if (arr[key] > 1) { \ + fail=1; \ + printf("%d %s are included\n", arr[key], key); \ + } \ + } \ + if (fail == 1) \ + exit 1; \ + }' $$i || { echo "Duplicate header(s) in $$i"; exit 1; }; \ + done + # 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