[pypy-svn] r13408 - in pypy/dist/pypy/translator: c genc/test

arigo at codespeak.net arigo at codespeak.net
Tue Jun 14 21:40:03 CEST 2005


Author: arigo
Date: Tue Jun 14 21:40:03 2005
New Revision: 13408

Modified:
   pypy/dist/pypy/translator/c/int_include.h
   pypy/dist/pypy/translator/genc/test/test_typed.py
Log:
Re-enabled old skipped tests, which work with the new genc.

Shut up gcc warnings in case constant numbers are passed in
OP_INT_FLOORDIV_OVF or OP_INT_MOD_OVF.



Modified: pypy/dist/pypy/translator/c/int_include.h
==============================================================================
--- pypy/dist/pypy/translator/c/int_include.h	(original)
+++ pypy/dist/pypy/translator/c/int_include.h	Tue Jun 14 21:40:03 2005
@@ -106,7 +106,7 @@
 #define OP_INT_FLOORDIV(x,y,r,err) r = op_divmod_adj(x, y, NULL);
 
 #define OP_INT_FLOORDIV_OVF(x,y,r,err) \
-	if ((long)(y) == -1 && (long)(x) < 0 && (long)(x) == -(long)(x)) \
+	if ((long)(y) == -1 && (long)(x) < 0 && ((unsigned long)(x) << 1) == 0) \
 		FAIL_OVF(err, "integer division") \
 	OP_INT_FLOORDIV(x,y,r,err)
 
@@ -123,7 +123,7 @@
 #define OP_INT_MOD(x,y,r,err)     op_divmod_adj(x, y, &r);
 
 #define OP_INT_MOD_OVF(x,y,r,err) \
-	if ((long)(y) == -1 && (long)(x) < 0 && (long)x == -(long)(x)) \
+	if ((long)(y) == -1 && (long)(x) < 0 && ((unsigned long)(x) << 1) == 0) \
 		FAIL_OVF(err, "integer modulo") \
 	OP_INT_MOD(x,y,r,err);
 

Modified: pypy/dist/pypy/translator/genc/test/test_typed.py
==============================================================================
--- pypy/dist/pypy/translator/genc/test/test_typed.py	(original)
+++ pypy/dist/pypy/translator/genc/test/test_typed.py	Tue Jun 14 21:40:03 2005
@@ -69,7 +69,7 @@
 
     def test_int_overflow(self):
         fn = self.getcompiled(snippet.add_func)
-        raises(OverflowError, fn, sys_maxint())
+        raises(OverflowError, fn, sys.maxint)
 
     def test_int_div_ovf_zer(self): # 
         fn = self.getcompiled(snippet.div_func)
@@ -94,10 +94,5 @@
         fn = self.getcompiled(snippet.unary_func)
         for i in range(-3,3):
             assert fn(i) == (-(i), abs(i-1))
-        raises (OverflowError, fn, -sys_maxint()-1)
-        raises (OverflowError, fn, -sys_maxint())
-
-def sys_maxint():
-    if sys.maxint != 2147483647:
-        py.test.skip("genc ovf incomplete: int might differ from long")
-    return sys.maxint
+        raises (OverflowError, fn, -sys.maxint-1)
+        raises (OverflowError, fn, -sys.maxint)



More information about the Pypy-commit mailing list