summaryrefslogtreecommitdiff
path: root/cffi/verifier.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2012-06-12 11:01:30 +0200
committerArmin Rigo <arigo@tunes.org>2012-06-12 11:01:30 +0200
commit8109c74dce4e9a95d63b15960978fc7311090681 (patch)
tree5d5c01cfa7569cf1ba7d4a10bdcbc603378c5d7a /cffi/verifier.py
parent837dde02d3ca8bba8c31b7e76883be98fac9943e (diff)
downloadcffi-linux-only.tar.gz
Finish the (non-partial) struct verification. For now useslinux-only
'typeof()', which is a gcc extension.
Diffstat (limited to 'cffi/verifier.py')
-rw-r--r--cffi/verifier.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/cffi/verifier.py b/cffi/verifier.py
index 97fe2be..353890d 100644
--- a/cffi/verifier.py
+++ b/cffi/verifier.py
@@ -21,15 +21,19 @@ class Verifier(object):
tst_file_base = ffiplatform._get_test_file_base()
self.has_printf = False
with open(tst_file_base + '.c', 'w') as f:
- f.write('#include <stdio.h>\n'
- '#include <stdint.h>\n'
- '#include <stddef.h>\n'
- '#include <unistd.h>\n'
- '\n'
- '#define __sameconstant__(x, y) \\\n'
- ' { int result[1-2*((x)-(y))*((x)-(y))]; }\n'
- '\n'
- )
+ f.write("""\
+#include <stdio.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <unistd.h>
+
+#define __sameconstant__(x, y) \\
+ { int result[1-2*((x)-(y))*((x)-(y))]; }
+
+#define __sametype__(ppresult, typename) \\
+ { ppresult = (typename**)0; }
+
+""")
f.write(preamble + "\n\n")
f.write('int main() {\n')
self.f = f