Skip to content

Commit

Permalink
Current windows.h did not work any more
Browse files Browse the repository at this point in the history
"ALIGNED_ATTR" CursorType had to be supported.
Furthermore an explicit Windows header file reading test was added

As a lot of additional Vector Intrinsics were added, these had to be
disabled, too.
  • Loading branch information
mrh1997 committed Sep 14, 2023
1 parent b6701e9 commit 7acb4d8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
15 changes: 13 additions & 2 deletions headlock/c_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,17 @@ class CParser:
'punpcklwd128': '__m128d', 'punpckldq128': '__m128d',
'punpcklqdq128': '__m128d', 'pandn128': '__m128d',
'pavgb128': '__m128d', 'pavgw128': '__m128d',
'cvtsi642ss': '__m128', 'cvtsi642ss': '__m128', 'cvtsi642sd': '__m128d',
'cvtsi642sd': '__m128d', 'paddsb128': '__m128i', 'paddsw128': '__m128i',
'paddusb128': '__m128i', 'paddusw128': '__m128i',
'psubsb128': '__m128i', 'psubsw128': '__m128i', 'psubusb128': '__m128i',
'psubusw128': '__m128i', 'pmaxsw128': '__m128i', 'pmaxub128': '__m128i',
'pminsw128': '__m128i', 'pminub128': '__m128i',
'movntps': '__m128', 'movntdq': '__m128', 'movntpd': '__m128'}
GCC_ZEROTYPE_MAP = {
'__m128': '_mm_setzero_ps()', '__v4sf': '_mm_setzero_ps()',
'__m128d': '_mm_setzero_pd()', 'int': '0'}
'__m128d': '__extension__(__m128){0,0,0,0}', 'int': '0',
'__m128i': '_mm_setzero_pd()'}

def __init__(self, predef_macros:Dict[str, Any]=None,
include_dirs:List[Path]=None,
Expand Down Expand Up @@ -423,7 +430,11 @@ def sys_inc_dir_args(sys_include_dirs):
'_mm_pause': '_mm_pause_CLANG',
'_mm_clflush': '_mm_clflush_CLANG',
'_mm_lfence': '_mm_lfence_CLANG',
'_mm_mfence': '_mm_mfence_CLANG'})
'_mm_mfence': '_mm_mfence_CLANG',
'__rdtsc': '__rdtsc_CLANG',
'__builtin_shuffle(...)':
self.GCC_ZEROTYPE_MAP['__m128d'],
'__iamcu__': '1'})
predefs.update({
f'__builtin_ia32_{nm}(...)': self.GCC_ZEROTYPE_MAP[tp]
for nm, tp in self.GCC_VECTOR_BUILTINS.items()})
Expand Down
2 changes: 2 additions & 0 deletions headlock/libclang/cindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,8 @@ def __repr__(self):
CursorKind.DLLEXPORT_ATTR = CursorKind(418)
CursorKind.DLLIMPORT_ATTR = CursorKind(419)

CursorKind.ALIGNED_ATTR = CursorKind(441)

###
# Preprocessing
CursorKind.PREPROCESSING_DIRECTIVE = CursorKind(500)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_c_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,4 +750,4 @@ def test_read_supportsDifferentCompilerTargets_ok(self, target, check_macro):
self.parse('#if !defined('+check_macro+')\n'
'#error missing '+check_macro+'\n'
'#endif',
target_compiler=target)
target_compiler=target)
8 changes: 8 additions & 0 deletions tests/test_testsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,14 @@ def test_attributeAnnotationSupport_onStdIntIncluded_ok(self):
with TSDummy() as ts:
assert '__cdecl' in ts.cdecl_func.ctype.__c_attribs__

@pytest.mark.skipif(sys.platform != "win32", reason="windows only")
def test_windowsHeaderFiles_ok(self, tmpdir):
TSDummy = self.cls_from_ccode(b'#include <windows.h>',
'include_windows_h.c')
with TSDummy() as ts:
pass



class TestCModule:

Expand Down

0 comments on commit 7acb4d8

Please sign in to comment.