]> xenbits.xensource.com Git - libvirt.git/commitdiff
cfg: Disallow usage of 'index' as variable name
authorJohn Ferlan <jferlan@redhat.com>
Tue, 14 Apr 2015 11:37:41 +0000 (07:37 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 14 Apr 2015 15:18:28 +0000 (11:18 -0400)
Since we've run afoul of the Xen-devel build for shadowing a global
declaration of 'index', just disallow using index for a variable name

cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 3111a89c9dee65a0d5672d778cefd7c014cc7e64..9ba2134e6015ea112e1893a5abb666a5c0a93d7d 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -564,6 +564,11 @@ sc_avoid_attribute_unused_in_header:
        halt='use ATTRIBUTE_UNUSED in .c rather than .h files'          \
          $(_sc_search_regexp)
 
+sc_prohibit_int_index:
+       @prohibit='\<(int|unsigned)\s*\*?index\>(\s|,|;)'       \
+       halt='use different name than 'index' for declaration'          \
+         $(_sc_search_regexp)
+
 sc_prohibit_int_ijk:
        @prohibit='\<(int|unsigned) ([^(=]* )*(i|j|k)\>(\s|,|;)'        \
        halt='use size_t, not int/unsigned int for loop vars i, j, k'   \