Commits

Armin Rigo committed 6c0c72f

More tweaks, preventing a compiler warning

Comments (0)

Files changed (2)

         else:
             prnt('  if (LONG_MIN <= (%s) && (%s) <= LONG_MAX)' % (name, name))
             prnt('    o = PyInt_FromLong((long)(%s));' % (name,))
-            prnt('  else if ((%s) < 0)' % (name,))
+            prnt('  else if ((%s) <= 0)' % (name,))
             prnt('    o = PyLong_FromLongLong((long long)(%s));' % (name,))
             prnt('  else')
             prnt('    o = PyLong_FromUnsignedLongLong('

testing/test_verify.py

     ffi = FFI()
     # use 'static const int', as generally documented, although in this
     # case the 'static' is completely ignored.
-    ffi.cdef("static const int AA, BB, CC;")
+    ffi.cdef("static const int AA, BB, CC, DD;")
     lib = ffi.verify("#define AA 42\n"
                      "#define BB (-43)\n"
-                     "#define CC (22*2)\n")
+                     "#define CC (22*2)\n"
+                     "#define DD ((unsigned int)142)\n")
     assert lib.AA == 42
     assert lib.BB == -43
     assert lib.CC == 44
+    assert lib.DD == 142
 
 def test_global_const_int_size():
     # integer constants: ignore the declared type, always just use the value