Commit 7ab23273 authored by Armin Rigo's avatar Armin Rigo
Browse files

update to cffi/eebc6733b38d

parent 789b5384030f
......@@ -4,6 +4,7 @@ import pytest
import sys, os, math, weakref
from cffi import FFI, VerificationError, VerificationMissing, model, FFIError
from extra_tests.cffi_tests.support import *
from extra_tests.cffi_tests.support import extra_compile_args
lib_m = ['m']
......@@ -14,17 +15,6 @@ if sys.platform == 'win32':
lib_m = ['msvcrt']
pass # no obvious -Werror equivalent on MSVC
else:
if (sys.platform == 'darwin' and
[int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0]):
# assume a standard clang or gcc
extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion']
# special things for clang
extra_compile_args.append('-Qunused-arguments')
else:
# assume a standard gcc
extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion',
'-Wno-unused-parameter']
class FFI(FFI):
def verify(self, *args, **kwds):
return super(FFI, self).verify(
......
......@@ -35,8 +35,9 @@ def verify(ffi, module_name, source, *args, **kwds):
source = 'extern "C" {\n%s\n}' % (source,)
elif sys.platform != 'win32':
# add '-Werror' to the existing 'extra_compile_args' flags
from extra_tests.cffi_tests.support import extra_compile_args
kwds['extra_compile_args'] = (kwds.get('extra_compile_args', []) +
['-Werror'])
extra_compile_args)
return _verify(ffi, module_name, source, *args, **kwds)
def test_set_source_no_slashes():
......@@ -2039,7 +2040,7 @@ def test_function_returns_float_complex():
ffi.cdef("float _Complex f1(float a, float b);");
lib = verify(ffi, "test_function_returns_float_complex", """
#include <complex.h>
static float _Complex f1(float a, float b) { return a + I*2.0*b; }
static float _Complex f1(float a, float b) { return a + I*2.0f*b; }
""", no_cpp=True) # <complex.h> fails on some systems with C++
result = lib.f1(1.25, 5.1)
assert type(result) == complex
......
......@@ -5,7 +5,7 @@ from cffi import FFI, FFIError, VerificationError, VerificationMissing, model
from cffi import CDefError
from cffi import recompiler
from extra_tests.cffi_tests.support import *
from extra_tests.cffi_tests.support import _verify
from extra_tests.cffi_tests.support import _verify, extra_compile_args
import _cffi_backend
lib_m = ['m']
......@@ -14,18 +14,6 @@ if sys.platform == 'win32':
import distutils.ccompiler
if distutils.ccompiler.get_default_compiler() == 'msvc':
lib_m = ['msvcrt']
extra_compile_args = [] # no obvious -Werror equivalent on MSVC
else:
if (sys.platform == 'darwin' and
[int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0]):
# assume a standard clang or gcc
extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion']
# special things for clang
extra_compile_args.append('-Qunused-arguments')
else:
# assume a standard gcc
extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion',
'-Wno-unused-parameter']
class FFI(FFI):
error = _cffi_backend.FFI.error
......
# Generated by pypy/tool/import_cffi.py
import sys
import sys, os
if sys.version_info < (3,):
__all__ = ['u']
......@@ -87,3 +87,24 @@ def _verify(ffi, module_name, preamble, *args, **kwds):
if not name.startswith('_') and not hasattr(module.ffi, name):
setattr(ffi, name, NotImplemented)
return module.lib
# For testing, we call gcc with "-Werror". This is fragile because newer
# versions of gcc are always better at producing warnings, particularly for
# auto-generated code. We need here to adapt and silence them as needed.
if sys.platform == 'win32':
extra_compile_args = [] # no obvious -Werror equivalent on MSVC
else:
if (sys.platform == 'darwin' and
[int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0]):
# assume a standard clang or gcc
extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion',
'-Wno-unreachable-code']
# special things for clang
extra_compile_args.append('-Qunused-arguments')
else:
# assume a standard gcc
extra_compile_args = ['-Werror', '-Wall', '-Wextra', '-Wconversion',
'-Wno-unused-parameter',
'-Wno-unreachable-code']
Metadata-Version: 1.1
Name: cffi
Version: 1.13.1
Version: 1.13.2
Summary: Foreign Function Interface for Python calling C code.
Home-page: http://cffi.readthedocs.org
Author: Armin Rigo, Maciej Fijalkowski
......
......@@ -5,8 +5,8 @@ from .api import FFI
from .error import CDefError, FFIError, VerificationError, VerificationMissing
from .error import PkgConfigError
__version__ = "1.13.1"
__version_info__ = (1, 13, 1)
__version__ = "1.13.2"
__version_info__ = (1, 13, 2)
# The verifier module file names are based on the CRC32 of a string that
# contains the following version number. It may be older than __version__
......
......@@ -261,12 +261,12 @@ _CFFI_UNUSED_FN static int _cffi_to_c_char32_t(PyObject *o)
return (int)_cffi_to_c_wchar3216_t(o);
}
_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char32_t(int x)
_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char32_t(unsigned int x)
{
if (sizeof(_cffi_wchar_t) == 4)
return _cffi_from_c_wchar_t((_cffi_wchar_t)x);
else
return _cffi_from_c_wchar3216_t(x);
return _cffi_from_c_wchar3216_t((int)x);
}
......
......@@ -224,7 +224,7 @@ static int _cffi_initialize_python(void)
if (f != NULL && f != Py_None) {
PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
"\ncompiled with cffi version: 1.13.1"
"\ncompiled with cffi version: 1.13.2"
"\n_cffi_backend module: ", f);
modules = PyImport_GetModuleDict();
mod = PyDict_GetItemString(modules, "_cffi_backend");
......
......@@ -159,9 +159,9 @@ def _warn_for_string_literal(csource):
def _warn_for_non_extern_non_static_global_variable(decl):
if not decl.storage:
import warnings
warnings.warn("Declaration of global variable '%s' in cdef() should "
"be marked 'extern' for consistency (or possibly "
"'static' in API mode)" % (decl.name,))
warnings.warn("Global variable '%s' in cdef(): for consistency "
"with C it should have a storage class specifier "
"(usually 'extern')" % (decl.name,))
def _preprocess(csource):
# Remove comments. NOTE: this only work because the cdef() section
......
# ____________________________________________________________
import sys
assert __version__ == "1.13.1", ("This test_c.py file is for testing a version"
assert __version__ == "1.13.2", ("This test_c.py file is for testing a version"
" of cffi that differs from the one that we"
" get from 'import _cffi_backend'")
if sys.version_info < (3,):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment