summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2009-11-13 20:33:19 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2009-11-13 20:33:19 -0500
commita35aa12a916f0ba167b109e709538e4289141e58 (patch)
tree900b808f959bcab4558e9639dd59b153b585c660
parente736aed161f54bb5130458b88001fa2c3ff31051 (diff)
downloadcheck-cpython-a35aa12a916f0ba167b109e709538e4289141e58.tar.gz
check-cpython-a35aa12a916f0ba167b109e709538e4289141e58.tar.xz
check-cpython-a35aa12a916f0ba167b109e709538e4289141e58.zip
Add current_element to error messages
-rw-r--r--README10
-rw-r--r--pyarg-parsetuple.cocci2
-rw-r--r--validate.py7
3 files changed, 14 insertions, 5 deletions
diff --git a/README b/README
index 0cd9087..b3713db 100644
--- a/README
+++ b/README
@@ -13,4 +13,12 @@ init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: buggy.c
buggy.c:13: Mismatching type of argument 1: expected "int *" but got "unsigned long *"
-which correctly detects an issue seen in socket.htons() on 64bit big endian machines \ No newline at end of file
+which correctly detects an issue seen in socket.htons() on 64bit big endian machines
+
+
+Similarly, it detects the deliberate bug here:
+spatch -sp_file pyarg-parsetuple.cocci ../python-svn/Modules/xxmodule.c
+init_defs_builtins: /usr/share/coccinelle/standard.h
+HANDLING: ../python-svn/Modules/xxmodule.c
+TYPE: header ../python-svn/Modules/Python.h not found
+../python-svn/Modules/xxmodule.c:206: unknown format char: '#'
diff --git a/pyarg-parsetuple.cocci b/pyarg-parsetuple.cocci
index a33e678..111d91a 100644
--- a/pyarg-parsetuple.cocci
+++ b/pyarg-parsetuple.cocci
@@ -2,7 +2,7 @@
"""
Analyze format strings, compare to vararg types actually passed
-FIXME: generalize this to varargs
+FIXME: generalize this to varargs; can coccinelle do this?
"""
import sys
sys.path.append('.')
diff --git a/validate.py b/validate.py
index 3f32745..ebe5977 100644
--- a/validate.py
+++ b/validate.py
@@ -7,9 +7,10 @@ class CExtensionError(Exception):
self.location = location
def __str__(self):
- return '%s:%s: %s' % (self.location.file,
- self.location.line,
- self._get_desc())
+ return '%s:%s:%s:%s' % (self.location.file,
+ self.location.line,
+ self.location.current_element,
+ self._get_desc())
def _get_desc(self):
raise NotImplementedError