diff options
author | Armin Rigo <arigo@tunes.org> | 2019-10-15 14:26:56 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2019-10-15 14:26:56 +0200 |
commit | 45d5b2cd9d698c0ed0eb787cf13dafacb3ac64c5 (patch) | |
tree | c57d1786b6c77a8c8d3ee7f82cc1c6cad9ccd896 /cffi | |
parent | e81b474238a0aced11a484b1eb00d32b923de799 (diff) | |
parent | 3f3e8e2db85dd6299aaf0a60d8dd6858ecb99fd0 (diff) | |
download | cffi-45d5b2cd9d698c0ed0eb787cf13dafacb3ac64c5.tar.gz |
hg merge release-1.13.0
Diffstat (limited to 'cffi')
-rw-r--r-- | cffi/cparser.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cffi/cparser.py b/cffi/cparser.py index 9cb3412..c275f42 100644 --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -156,6 +156,13 @@ def _warn_for_string_literal(csource): "confuse pre-parsing.") break +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,)) + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -506,6 +513,7 @@ class Parser(object): if (quals & model.Q_CONST) and not tp.is_array_type: self._declare('constant ' + decl.name, tp, quals=quals) else: + _warn_for_non_extern_non_static_global_variable(decl) self._declare('variable ' + decl.name, tp, quals=quals) def parse_type(self, cdecl): |