diff options
author | Armin Rigo <arigo@tunes.org> | 2019-10-14 09:16:01 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2019-10-14 09:16:01 +0200 |
commit | 2e1c8e4f059b1ae7cc06a1f45f40bbbf9d08f5d0 (patch) | |
tree | d4747cf3365cc6a782b226acecfebd612ad00105 /testing/cffi0/test_function.py | |
parent | 7fa9a5f8a80e0e460c486a7f90ae12886b22b0d9 (diff) | |
download | cffi-2e1c8e4f059b1ae7cc06a1f45f40bbbf9d08f5d0.tar.gz |
Add a warning when we use in cdef() a global variable without also specifying a storage class (extern or static)
Diffstat (limited to 'testing/cffi0/test_function.py')
-rw-r--r-- | testing/cffi0/test_function.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py index 120d7eb..d1f9ce4 100644 --- a/testing/cffi0/test_function.py +++ b/testing/cffi0/test_function.py @@ -113,7 +113,7 @@ class TestFunction(object): ffi = FFI(backend=self.Backend()) ffi.cdef(""" int fputs(const char *, void *); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -130,7 +130,7 @@ class TestFunction(object): ffi = FFI(backend=self.Backend()) ffi.cdef(""" int fputs(char *, void *); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -147,7 +147,7 @@ class TestFunction(object): ffi = FFI(backend=self.Backend()) ffi.cdef(""" int fprintf(void *, const char *format, ...); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -209,7 +209,7 @@ class TestFunction(object): py.test.skip("probably no symbol 'stderr' in the lib") ffi.cdef(""" int fputs(const char *, void *); - void *stderr; + extern void *stderr; """) needs_dlopen_none() ffi.C = ffi.dlopen(None) @@ -256,7 +256,7 @@ class TestFunction(object): py.test.skip("probably no symbol 'stdout' in the lib") ffi = FFI(backend=self.Backend()) ffi.cdef(""" - void *stdout; + extern void *stdout; """) needs_dlopen_none() C = ffi.dlopen(None) @@ -496,7 +496,7 @@ class TestFunction(object): ffi.cdef(""" typedef enum { MYE1, MYE2 } myenum_t; double myfunc(double); - double myvar; + extern double myvar; const double myconst; #define MYFOO 42 """) @@ -507,7 +507,7 @@ class TestFunction(object): if self.Backend is CTypesBackend: py.test.skip("not with the ctypes backend") ffi = FFI(backend=self.Backend()) - ffi.cdef("int foobar(void); int foobaz;") + ffi.cdef("int foobar(void); extern int foobaz;") lib = ffi.dlopen(lib_m) ffi.dlclose(lib) e = py.test.raises(ValueError, getattr, lib, 'foobar') |