summaryrefslogtreecommitdiff
path: root/cffi
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-10-20 10:02:23 +0200
committerArmin Rigo <arigo@tunes.org>2015-10-20 10:02:23 +0200
commit163a6470af80b75a7a4b0f02257fc774fed2dc92 (patch)
treed9cdf82e608da8f24beef270464cc618833e8753 /cffi
parentee59b4e478cce7c7bd9ef5f7d567c2a5075877b7 (diff)
downloadcffi-163a6470af80b75a7a4b0f02257fc774fed2dc92.tar.gz
Issue #225: Ignore basic SAL annotations on Windows.
Diffstat (limited to 'cffi')
-rw-r--r--cffi/cparser.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cffi/cparser.py b/cffi/cparser.py
index 78bd01a..da017e4 100644
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -29,6 +29,8 @@ _r_int_literal = re.compile(r"-?0?x?[0-9a-f]+[lu]*$", re.IGNORECASE)
_r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b")
_r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b")
_r_cdecl = re.compile(r"\b__cdecl\b")
+_r_SAL = re.compile(r"([(,]\s*)(_In_|_Inout_|_Out_|_Outptr_|"
+ r"_In_opt_|_Inout_opt_|_Out_opt_|_Outptr_opt_)\b")
def _get_parser():
global _parser_cache
@@ -55,6 +57,8 @@ def _preprocess(csource):
csource = _r_stdcall2.sub(' volatile volatile const(', csource)
csource = _r_stdcall1.sub(' volatile volatile const ', csource)
csource = _r_cdecl.sub(' ', csource)
+ if sys.platform == 'win32':
+ csource = _r_SAL.sub(r'\1 ', csource)
# Replace "[...]" with "[__dotdotdotarray__]"
csource = _r_partial_array.sub('[__dotdotdotarray__]', csource)
# Replace "...}" with "__dotdotdotNUM__}". This construction should