Changeset: 46f12e85984a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=46f12e85984a
Modified Files:
testing/malcheck.py
Branch: Jul2017
Log Message:
Improve type checking.
diffs (46 lines):
diff --git a/testing/malcheck.py b/testing/malcheck.py
--- a/testing/malcheck.py
+++ b/testing/malcheck.py
@@ -46,7 +46,7 @@ atomfunctypes = {
'cmp': ('int', (('void *', True), ('void *', True))),
'del': ('void', (('Heap *', False), ('var_t *', False))),
'fix': ('int', (('void *', True),)),
- 'fromstr': ('int', (('char *', True), ('int *', False), ('ptr *', False))),
+ 'fromstr': ('int', (('char *', True), ('int *', False), ('void **',
False))),
'hash': ('BUN', (('void *', True),)),
'heap': ('void', (('Heap *', False), ('size_t', False))),
'length': ('int', (('void *', False),)),
@@ -55,7 +55,7 @@ atomfunctypes = {
'put': ('var_t', (('Heap *', False), ('var_t *', False), ('void *',
True))),
'read': ('void *', (('void *', False), ('stream *', False), ('size_t',
False))),
'storage': ('long', (('void', False),)),
- 'tostr': ('int', (('str *', False), ('int *', False), ('void *', True))),
+ 'tostr': ('int', (('char **', False), ('int *', False), ('void *', True))),
'unfix': ('int', (('void *', True),)),
'write': ('gdk_return', (('void *', True), ('stream *', False), ('size_t',
False))),
}
@@ -255,7 +255,7 @@ else:
crtype, cargs, funcf = odecls[func]
if len(args) != len(cargs):
print '%s in %s: argument count mismatch for command %s for
atom %s in %s' % (func, funcf, malf, atom, f)
- elif rtype != crtype and rtype == 'void *' and crtype != atm + '
*' and (base != 'str' or (crtype != atm and crtype != 'char *')):
+ elif rtype != crtype and (rtype != 'void *' or crtype != atm + '
*'):
print '%s in %s: return type mismatch for command %s for atom
%s in %s (%s vs %s)' % (func, funcf, malf, atom, f, rtype, crtype)
else:
for i in range(len(args)):
@@ -263,6 +263,14 @@ else:
a2, r2 = cargs[i]
if r2 and not r1:
print 'argument %d of %s in %s incorrectly declared
const for atom command %s in %s' % (i+1, func, funcf, malf, f)
- if a1 != a2 and a1 == 'void *' and a2 != atm + ' *' and
(base != 'str' or (a2 != atm and a2 != 'char *')):
+ if a1 != a2 and \
+ (a1 != 'void *' or a2 != atm + ' *') and \
+ (a1 != 'char **' or a2 != 'str *') and \
+ (a1 != 'void **' or a2 != atm + ' **') and \
+ (base != 'str' or a1 != 'void *' or a2 != atm) and \
+ (base != 'str' or a1 != 'void *' or a2 != 'char *') and
\
+ (base != 'str' or a1 != 'void **' or a2 != atm + ' *')
and \
+ (base != 'str' or a1 != 'void **' or a2 != 'str *') and
\
+ (base != 'str' or a1 != 'char **' or a2 != atm + ' *'):
print (a1,a2,atom,base)
print '%s in %s: argument %d mismatch for command %s
for atom %s in %s (%s vs %s)' % (func, funcf, i+1, malf, atom, f, a1, a2)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list