On 03/01/2012 07:40 PM, Eric Blake wrote: > Make it easier to detect invalid cross-directory includes, by > adding a syntax check. The check is designed to be extensible: > the default case lists only the non-driver directories, and > specific directories can list a different set (for example, > util/ can only use itself, network/ can only use itself, util/, > or conf/). > > * .gnulib: Update to latest, for syntax check improvment. > * cfg.mk (sc_prohibit_cross_inclusion): New check. > (sc_prohibit_strncmp, sc_libvirt_unmarked_diagnostics): Simplify. > --- > +# Our code is divided into modular subdirectories for a reason, and > +# lower-level code must not include higher-level headers. > +cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.)) > +cross_dirs_re=($(subst / ,/|,$(cross_dirs))) > +sc_prohibit_cross_inclusion: > + @for dir in $(cross_dirs); do \ > + case $$dir in \ > + util/) safe="util";; \ > + cpu/ | locking/ | network/ | rpc/ | security/) \ > + safe="($$dir|util|conf)";; \ > + xenapi/ | xenxs/ ) safe="($$dir|util|conf|xen)";; \ > + *) safe="($$dir|util|conf|cpu|network|locking|rpc|security)";; \ > + esac; \ > + in_vc_files="^src/$$dir" \ > + prohibit='^# *include .$(cross_dirs_re)' \ > + exclude="# *include .$$safe" \ > + halt='unsafe cross-directory include' \ Should this maybe say "prohibited" instead of "un-safe"? BTW, I just did a full build with the new gnulib, and tried syntax-check - it did properly catch the problem that I had removed in the patch that started this discussion. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list