[pypy-svn] r59443 - pypy/trunk/pypy/rpython/tool

afa at codespeak.net afa at codespeak.net
Mon Oct 27 13:11:20 CET 2008


Author: afa
Date: Mon Oct 27 13:11:20 2008
New Revision: 59443

Modified:
   pypy/trunk/pypy/rpython/tool/rfficache.py
Log:
Add a sanity check in sizeof_c_type, which fails on my machine:
It seems that Visual Studio does not recompile if the input files are too similar :-(


Modified: pypy/trunk/pypy/rpython/tool/rfficache.py
==============================================================================
--- pypy/trunk/pypy/rpython/tool/rfficache.py	(original)
+++ pypy/trunk/pypy/rpython/tool/rfficache.py	Mon Oct 27 13:11:20 2008
@@ -34,8 +34,12 @@
     return build_executable_cache([c_file], eci)
 
 def sizeof_c_type(c_typename, **kwds):
-    question = 'printf("%%d", sizeof(%s));' % (c_typename,);
-    return int(ask_gcc(question, **kwds))
+    question = 'printf("sizeof %s=%%d", sizeof(%s));' % (c_typename,
+                                                         c_typename)
+    answer = ask_gcc(question, **kwds).split('=')
+    assert answer[0] == "sizeof " + c_typename, "wrong program: " \
+           "sizeof %s expected, got %s" % (c_typename, answer[0])
+    return int(answer[1])
 
 class Platform:
     def __init__(self):



More information about the Pypy-commit mailing list