Author: Christian Tismer <[email protected]>
Branch: win64-stage1
Changeset: r50327:ffe08320d6bc
Date: 2011-12-09 16:18 +0100
http://bitbucket.org/pypy/pypy/changeset/ffe08320d6bc/
Log: Quite a simplification and improvement: removed the extra mess for
signed_defn.h and put it into the standard header
diff --git a/pypy/module/cpyext/include/Python.h
b/pypy/module/cpyext/include/Python.h
--- a/pypy/module/cpyext/include/Python.h
+++ b/pypy/module/cpyext/include/Python.h
@@ -35,8 +35,6 @@
# define Py_LOCAL_INLINE(type) static __inline type __fastcall
#endif
-#include "signed_defn.h"
-
/* Deprecated DL_IMPORT and DL_EXPORT macros */
#ifdef _WIN32
# if defined(Py_BUILD_CORE)
diff --git a/pypy/rlib/test/test_libffi.py b/pypy/rlib/test/test_libffi.py
--- a/pypy/rlib/test/test_libffi.py
+++ b/pypy/rlib/test/test_libffi.py
@@ -1,6 +1,6 @@
import sys
-import py, autopath
+import py
from pypy.rlib.libffi import (CDLL, Func, get_libc_name, ArgChain, types,
IS_32_BIT, array_getitem, array_setitem)
@@ -100,6 +100,7 @@
def setup_class(cls):
from pypy.tool.udir import udir
from pypy.translator.tool.cbuild import ExternalCompilationInfo
+ from pypy.translator.tool.cbuild import STANDARD_HEADER
from pypy.translator.platform import platform
BaseFfiTest.setup_class()
@@ -120,10 +121,8 @@
for match in re.finditer(" ([a-z_]+)\(", meth.__doc__):
exports.append(match.group(1))
#
- c_file.write(py.code.Source('\n'.join(snippets)))
- eci = ExternalCompilationInfo(
- export_symbols=exports,
-
include_dirs=[str(py.path.local(autopath.pypydir).join('translator', 'c'))])
+ c_file.write(STANDARD_HEADER + py.code.Source('\n'.join(snippets)))
+ eci = ExternalCompilationInfo(export_symbols=exports)
cls.libfoo_name = str(platform.compile([c_file], eci, 'x',
standalone=False))
@@ -158,8 +157,7 @@
# ------------------------------------------------------------------------
def test_very_simple(self):
- """ #include "src/signed_defn.h"
-
+ """
int diff_xy(int x, Signed y)
{
return x - y;
@@ -238,8 +236,6 @@
def test_pointer_as_argument(self):
"""#include <stdlib.h>
- #include "src/signed_defn.h"
-
Signed inc(Signed* x)
{
Signed oldval;
@@ -276,8 +272,7 @@
lltype.free(ptr_result, flavor='raw')
def test_return_pointer(self):
- """ #include "src/signed_defn.h"
-
+ """
struct pair {
Signed a;
Signed b;
@@ -395,8 +390,7 @@
def test_byval_argument(self):
- """ #include "src/signed_defn.h"
-
+ """
struct Point {
Signed x;
Signed y;
@@ -426,8 +420,7 @@
lltype.free(ffi_point_struct, flavor='raw')
def test_byval_result(self):
- """ #include "src/signed_defn.h"
-
+ """
struct Point make_point(Signed x, Signed y) {
struct Point p;
p.x = x;
diff --git a/pypy/translator/c/src/g_prerequisite.h
b/pypy/translator/c/src/g_prerequisite.h
--- a/pypy/translator/c/src/g_prerequisite.h
+++ b/pypy/translator/c/src/g_prerequisite.h
@@ -8,8 +8,6 @@
# include "Python.h"
#endif
-#include "signed_defn.h"
-
#ifdef _WIN32
# include <io.h> /* needed, otherwise _lseeki64 truncates to 32-bits (??) */
#endif
diff --git a/pypy/translator/c/src/signals.h b/pypy/translator/c/src/signals.h
--- a/pypy/translator/c/src/signals.h
+++ b/pypy/translator/c/src/signals.h
@@ -7,7 +7,6 @@
#include <limits.h>
#include <stdlib.h>
-#include "src/signed_defn.h"
#ifdef _WIN32
#include <process.h>
diff --git a/pypy/translator/c/src/signed_defn.h
b/pypy/translator/c/src/signed_defn.h
deleted file mode 100644
--- a/pypy/translator/c/src/signed_defn.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* this file defines Signed and Unsigned */
-
-#ifndef SIGNED_DEFN_H
-#define SIGNED_DEFN_H
-
-#ifdef _WIN64
- typedef __int64 Signed;
- typedef unsigned __int64 Unsigned;
-# define SIGNED_MIN LLONG_MIN
-#else
- typedef long Signed;
- typedef unsigned long Unsigned;
-# define SIGNED_MIN LONG_MIN
-#endif
-
-#endif
-
-/* end of signed_def.h */
diff --git a/pypy/translator/tool/cbuild.py b/pypy/translator/tool/cbuild.py
--- a/pypy/translator/tool/cbuild.py
+++ b/pypy/translator/tool/cbuild.py
@@ -320,4 +320,13 @@
#define __XSI_VISIBLE 700
/* Windows: winsock/winsock2 mess */
#define WIN32_LEAN_AND_MEAN
+#ifdef _WIN64
+ typedef __int64 Signed;
+ typedef unsigned __int64 Unsigned;
+# define SIGNED_MIN LLONG_MIN
+#else
+ typedef long Signed;
+ typedef unsigned long Unsigned;
+# define SIGNED_MIN LONG_MIN
+#endif
'''
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit