diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-03-26 20:56:20 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-03-26 20:56:20 +0200 |
commit | 049b63bda2c0ad4fa76e4adb17b6b1e331daff7a (patch) | |
tree | a8b3136f6edf856e3b801bfaae7dfd9d2ebab155 /cfg.mk | |
parent | 63a7e8cea42f601be20634a193b09f0af5f9c1d8 (diff) |
New upstream version 0.9.11~rc1
Diffstat (limited to 'cfg.mk')
-rw-r--r-- | cfg.mk | 53 |
1 files changed, 43 insertions, 10 deletions
@@ -346,12 +346,12 @@ sc_prohibit_access_xok: # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp # Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0. +snp_ = strncmp *\(.+\) sc_prohibit_strncmp: - @grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \ - $$($(VC_LIST_EXCEPT)) \ - | grep -vE ':# *define STR(N?EQLEN|PREFIX)\(' && \ - { echo '$(ME): use STREQLEN or STRPREFIX instead of str''ncmp' \ - 1>&2; exit 1; } || : + @prohibit='! *strncmp *\(|\<$(snp_) *[!=]=|[!=]= *$(snp_)' \ + exclude=':# *define STR(N?EQLEN|PREFIX)\(' \ + halt='$(ME): use STREQLEN or STRPREFIX instead of str''ncmp' \ + $(_sc_search_regexp) # Use virAsprintf rather than as'printf since *strp is undefined on error. sc_prohibit_asprintf: @@ -416,6 +416,12 @@ sc_prohibit_ctype_h: halt="don't use ctype.h; instead, use c-ctype.h" \ $(_sc_search_regexp) +# Insist on correct types for [pug]id. +sc_correct_id_types: + @prohibit='\<(int|long) *[pug]id\>' \ + halt="use pid_t for pid, uid_t for uid, gid_t for gid" \ + $(_sc_search_regexp) + # Ensure that no C source file, docs, or rng schema uses TABs for # indentation. Also match *.h.in files, to get libvirt.h.in. Exclude # files in gnulib, since they're imported. @@ -457,6 +463,12 @@ sc_prohibit_xmlGetProp: halt='use virXMLPropString, not xmlGetProp' \ $(_sc_search_regexp) +# xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well +sc_prohibit_xmlURI: + @prohibit='\<xml(ParseURI|SaveUri) *\(' \ + halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)' \ + $(_sc_search_regexp) + # ATTRIBUTE_UNUSED should only be applied in implementations, not # header declarations sc_avoid_attribute_unused_in_header: @@ -562,11 +574,10 @@ func_re := ($(func_or)) # _("...: " # "%s", _("no storage vol w..." sc_libvirt_unmarked_diagnostics: - @grep -nE \ - '\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \ - | grep -v '_''(' && \ - { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ - exit 1; } || : + @prohibit='\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' \ + exclude='_\(' \ + halt='$(ME): found unmarked diagnostic(s)' \ + $(_sc_search_regexp) @{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \ grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \ | sed 's/_("[^"][^"]*"//;s/[ ]"%s"//' \ @@ -617,6 +628,26 @@ sc_prohibit_gettext_markup: halt='do not mark these strings for translation' \ $(_sc_search_regexp) +# 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' \ + $(_sc_search_regexp) \ + done + # When converting an enum to a string, make sure that we track any new # elements added to the enum by using a _LAST marker. sc_require_enum_last_marker: @@ -758,6 +789,8 @@ exclude_file_name_regexp--sc_prohibit_strncpy = \ exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$ +exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$ + exclude_file_name_regexp--sc_require_config_h = ^examples/ exclude_file_name_regexp--sc_require_config_h_first = ^examples/ |