]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: import latest gnulib
authorEric Blake <eblake@redhat.com>
Wed, 31 Mar 2010 23:02:10 +0000 (17:02 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 2 Apr 2010 16:18:55 +0000 (10:18 -0600)
A lot of syntax check rules have to be rewritten, but the
result is easier to maintain.  I tested each syntax rule
by intentionally introducing a temporary violation of the rule.
Additionally, some false positives for unmarked_diagnostics
crept in, and an improved copyright_format test caught some bugs.

* .gnulib: Update to latest.
* cfg.mk (sc_prohibit_test_minus_ao): Delete, it was moved into
gnulib's maint.mk.
(sc_avoid_write, sc_prohibit_strcmp_and_strncmp)
(sc_prohibit_asprintf, sc_prohibit_strncpy, sc_prohibit_readlink)
(sc_prohibit_gethostname, sc_prohibit_gettext_noop)
(sc_prohibit_VIR_ERR_NO_MEMORY, sc_prohibit_nonreentrant)
(sc_prohibit_ctype_h, sc_TAB_in_indentation)
(sc_avoid_ctype_macros)
(sc_prohibit_virBufferAdd_with_string_literal)
(sc_prohibit_gethostby, sc_copyright_format): Rewrite in terms of
new maint.mk macros.
(sc_libvirt_unmarked_diagnostics): Fix whitespace.
* .x-sc_unmarked_diagnostics: New file.
* tests/object-locking.ml: Fix copyright.
* tools/virt-pki-validate.in: Likewise.
* tools/virt-xml-validate.in: Likewise.

.gnulib
.x-sc_unmarked_diagnostics [new file with mode: 0644]
cfg.mk
tests/object-locking.ml
tools/virt-pki-validate.in
tools/virt-xml-validate.in

diff --git a/.gnulib b/.gnulib
index 4f01268d0c584c20704e42527f4fa125e7525aae..097c9ce08a79899ff942b9b6ee811e613605499f 160000 (submodule)
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 4f01268d0c584c20704e42527f4fa125e7525aae
+Subproject commit 097c9ce08a79899ff942b9b6ee811e613605499f
diff --git a/.x-sc_unmarked_diagnostics b/.x-sc_unmarked_diagnostics
new file mode 100644 (file)
index 0000000..4135cc7
--- /dev/null
@@ -0,0 +1,2 @@
+docs/apibuild.py
+tests/virt-aa-helper-test
diff --git a/cfg.mk b/cfg.mk
index 2e7b68ac500b478861600535c8bb45186b4f07c5..b6b25307affc002fc4096f98394e2a940b4d22d3 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -71,99 +71,96 @@ useless_free_options =              \
 # Avoid uses of write(2).  Either switch to streams (fwrite), or use
 # the safewrite wrapper.
 sc_avoid_write:
-       @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then          \
-         grep '\<write *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$') &&     \
-           { echo "$(ME): the above files use write;"                  \
-             " consider using the safewrite wrapper instead"           \
-                 1>&2; exit 1; } || :;                                 \
-       else :;                                                         \
-       fi
+       @prohibit='\<write *\('                                         \
+       in_vc_files='\.c$$'                                             \
+       halt='consider using safewrite instead of write'                \
+        $(_sc_search_regexp)
 
 # Use STREQ rather than comparing strcmp == 0, or != 0.
 # Similarly, use STREQLEN or STRPREFIX rather than strncmp.
 sc_prohibit_strcmp_and_strncmp:
-       @re='strn?cmp *\('                                              \
-       msg='use STREQ() in place of the above uses of str[n]cmp'       \
-         $(_prohibit_regexp)
+       @prohibit='strn?cmp *\('                                        \
+       halt='use STREQ() in place of the above uses of str[n]cmp'      \
+         $(_sc_search_regexp)
 
 # Use virAsprintf rather than a'sprintf since *strp is undefined on error.
 sc_prohibit_asprintf:
-       @re='\<[a]sprintf\>'                                            \
-       msg='use virAsprintf, not a'sprintf                             \
-         $(_prohibit_regexp)
+       @prohibit='\<[a]sprintf\>'                                      \
+       halt='use virAsprintf, not a'sprintf                            \
+         $(_sc_search_regexp)
 
 sc_prohibit_strncpy:
-       @re='strncpy *\('                                               \
-       msg='use virStrncpy, not strncpy'                               \
-         $(_prohibit_regexp)
+       @prohibit='strncpy *\('                                         \
+       halt='use virStrncpy, not strncpy'                              \
+         $(_sc_search_regexp)
 
 sc_prohibit_readlink:
-       @re='readlink *\('                                              \
-       msg='use virFileResolveLink, not readlink'                      \
-         $(_prohibit_regexp)
+       @prohibit='readlink *\('                                        \
+       halt='use virFileResolveLink, not readlink'                     \
+         $(_sc_search_regexp)
 
 sc_prohibit_gethostname:
-       @re='gethostname *\('                                           \
-       msg='use virGetHostname, not gethostname'                       \
-         $(_prohibit_regexp)
+       @prohibit='gethostname *\('                                     \
+       halt='use virGetHostname, not gethostname'                      \
+         $(_sc_search_regexp)
 
 sc_prohibit_gettext_noop:
-       @re='gettext_noop *\('                                          \
-       msg='use N_, not gettext_noop'                                  \
-         $(_prohibit_regexp)
+       @prohibit='gettext_noop *\('                                    \
+       halt='use N_, not gettext_noop'                                 \
+         $(_sc_search_regexp)
 
 sc_prohibit_VIR_ERR_NO_MEMORY:
-       @re='\<V''IR_ERR_NO_MEMORY\>'                                   \
-       msg='use virReportOOMError, not V'IR_ERR_NO_MEMORY              \
-         $(_prohibit_regexp)
+       @prohibit='\<V''IR_ERR_NO_MEMORY\>'                             \
+       halt='use virReportOOMError, not V'IR_ERR_NO_MEMORY             \
+         $(_sc_search_regexp)
 
+# Use a subshell for each function, to give the optimal warning message.
 include $(srcdir)/Makefile.nonreentrant
 sc_prohibit_nonreentrant:
        @fail=0 ; \
        for i in $(NON_REENTRANT) ; \
        do \
-          grep --before 2 --after 1 -nE "\<$$i\>[:space:]*\(" $$($(VC_LIST_EXCEPT)) && \
-            fail=1 && echo "$(ME): use $${i}_r, not $${i}" || : ; \
+           (prohibit="\\<$$i *\\("                                     \
+            halt="use $${i}_r, not $$i"                                \
+            $(_sc_search_regexp)                                       \
+           ) || fail=1;                                                \
        done ; \
        exit $$fail
 
 # Prohibit the inclusion of <ctype.h>.
 sc_prohibit_ctype_h:
-       @grep -E '^# *include  *<ctype\.h>' $$($(VC_LIST_EXCEPT)) &&    \
-         { echo "$(ME): don't use ctype.h; instead, use c-ctype.h"     \
-               1>&2; exit 1; } || :
+       @prohibit='^# *include  *<ctype\.h>'                            \
+       halt="don't use ctype.h; instead, use c-ctype.h"                \
+        $(_sc_search_regexp)
 
 # Ensure that no C source file uses TABs for indentation.
 # Also match *.h.in files, to get libvirt.h.in.
 # Exclude files in gnulib, since they're imported.
 sc_TAB_in_indentation:
-       @grep -lE '^ *  ' /dev/null                                     \
-            $$($(VC_LIST_EXCEPT)                                       \
-               | grep -E '\.(rng|[ch](\.in)?)$$'                       \
-               | grep -v '^gnulib/') &&                                \
-         { echo '$(ME): found TAB(s) used for indentation in C sources;'\
-             'use spaces' 1>&2; exit 1; } || :
+       @prohibit='^ *  '                                               \
+       in_vc_files='\.(rng|[ch](\.in)?)$$'                             \
+       halt='use spaces, not TAB, for indentation in C sources'        \
+        $(_sc_search_regexp)
 
 ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
 
 sc_avoid_ctype_macros:
-       @grep -E '\b($(ctype_re)) *\(' /dev/null                        \
-            $$($(VC_LIST_EXCEPT)) &&                                   \
-         { echo "$(ME): don't use ctype macros (use c-ctype.h)"        \
-               1>&2; exit 1; } || :
+       @prohibit='\b($(ctype_re)) *\('                                 \
+       halt="don't use ctype macros (use c-ctype.h)"                   \
+        $(_sc_search_regexp)
 
 sc_prohibit_virBufferAdd_with_string_literal:
-       @re='\<virBufferAdd *\([^,]+, *"[^"]'                           \
-       msg='use virBufferAddLit, not virBufferAdd, with a string literal' \
-         $(_prohibit_regexp)
+       @prohibit='\<virBufferAdd *\([^,]+, *"[^"]'                     \
+       halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
+         $(_sc_search_regexp)
 
 # Not only do they fail to deal well with ipv6, but the gethostby*
 # functions are also not thread-safe.
 sc_prohibit_gethostby:
-       @re='\<gethostby(addr|name2?) *\('                              \
-       msg='use getaddrinfo, not gethostby*'                           \
-         $(_prohibit_regexp)
+       @prohibit='\<gethostby(addr|name2?) *\('                        \
+       halt='use getaddrinfo, not gethostby*'                          \
+         $(_sc_search_regexp)
 
 # Many of the function names below came from this filter:
 # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
@@ -239,7 +236,7 @@ func_re := ($(func_or))
 #    "%s", _("no storage vol w..."
 sc_libvirt_unmarked_diagnostics:
        @grep -nE                                                       \
-            '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
+           '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT))  \
          | grep -v '_''(' &&                                           \
          { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
            exit 1; } || :
@@ -272,22 +269,14 @@ sc_preprocessor_indentation:
          echo '$(ME): skipping test $@: cppi not installed' 1>&2;      \
        fi
 
-_m1 = use "test C1 && test C2", not "test C1 -''a C2"
-_m2 = use "test C1 || test C2", not "test C1 -''o C2"
-# Using test's -a and -o operators is not portable.
-sc_prohibit_test_minus_ao:
-       @re='(\<test| \[+) .+ -[ao] '                                   \
-       msg='$(_m1); $(_m2)'                                            \
-         $(_prohibit_regexp)
-
 sc_copyright_format:
-       @$(VC_LIST_EXCEPT) | xargs grep -ni 'copyright .*Red 'Hat       \
-         | grep -v Inc                                                 \
-         && { echo '$(ME): Red Hat copyright is missing Inc' 1>&2;     \
-              exit 1; } || :
-       @$(VC_LIST_EXCEPT) | xargs grep -ni 'copyright [^(].*Red 'Hat   \
-         && { echo '$(ME): consistently use (C) in Red Hat copyright' 1>&2; \
-              exit 1; } || :
+       @require='Copyright .*Red 'Hat', Inc\.'                         \
+       containing='Copyright .*Red 'Hat                                \
+       halt='Red Hat copyright is missing Inc.'                        \
+        $(_sc_search_regexp)
+       @prohibit='Copyright [^(].*Red 'Hat                             \
+       halt='consistently use (C) in Red Hat copyright'                \
+        $(_sc_search_regexp)
 
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null
index 1fddd5183b7434522fa2bc910ea2d40d7e4b54bf..ce3b40184138aca87d648afc80ee3c6086e0fa92 100644 (file)
@@ -1,7 +1,7 @@
 (*
  * Analyse libvirt driver API methods for mutex locking mistakes
  *
- * Copyright (C) 2008-2010 Red Hat, Inc
+ * Copyright (C) 2008-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index 72ed9e5539e650313e1ddeb1a395a72c31a63913..ee7b79d5d70c2fb47b96a5202aea3fb6fb54c2bf 100755 (executable)
@@ -297,7 +297,7 @@ Alternatively report bugs to your software distributor / vendor.
 
 =head1 COPYRIGHT
 
-Copyright (C) 2006-2009 by Red Hat, Inc
+Copyright (C) 2006-2010 by Red Hat, Inc.
 
 =head1 LICENSE
 
index a296c7ff058f44cfabf150ae0c0da83778f8d211..54d045c2a636659a250fd551bddfcc8def6215c6 100644 (file)
@@ -134,7 +134,7 @@ Alternatively report bugs to your software distributor / vendor.
 
 =head1 COPYRIGHT
 
-Copyright (C) 2009 by Red Hat, Inc
+Copyright (C) 2009-2010 by Red Hat, Inc.
 Copyright (C) 2009 by Daniel P. Berrange
 
 =head1 LICENSE