Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
7505ac6d
Commit
7505ac6d
authored
Apr 04, 2013
by
Nikita Nemkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow function pointer typedefs with calling convention specified.
parent
37ceab84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
9 deletions
+55
-9
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-1
tests/errors/e_callspec.pyx
tests/errors/e_callspec.pyx
+53
-8
No files found.
Cython/Compiler/Parsing.py
View file @
7505ac6d
...
...
@@ -2074,7 +2074,8 @@ def p_c_simple_base_type(s, self_flag, nonempty, templates = None):
# Make sure this is not a declaration of a variable or function.
if
s
.
sy
==
'('
:
s
.
next
()
if
s
.
sy
==
'*'
or
s
.
sy
==
'**'
or
s
.
sy
==
'&'
:
if
(
s
.
sy
==
'*'
or
s
.
sy
==
'**'
or
s
.
sy
==
'&'
or
(
s
.
sy
==
'IDENT'
and
s
.
systring
in
calling_convention_words
)):
s
.
put_back
(
'('
,
'('
)
else
:
s
.
put_back
(
'('
,
'('
)
...
...
tests/errors/e_callspec.pyx
View file @
7505ac6d
...
...
@@ -2,6 +2,10 @@
cimport
cython
ctypedef
int
USERTYPE
# Functions
@
cython
.
callspec
(
""
)
cdef
void
h1
():
pass
...
...
@@ -14,21 +18,62 @@ cdef void __stdcall h3(): pass
@
cython
.
callspec
(
"__fastcall"
)
cdef
void
__fastcall
h4
():
pass
cdef
USERTYPE
h5
():
return
0
cdef
USERTYPE
__cdecl
h6
():
return
0
cdef
USERTYPE
__stdcall
h7
():
return
0
cdef
USERTYPE
__fastcall
h8
():
return
0
@
cython
.
callspec
(
"__cdecl"
)
cdef
void
__stdcall
h
5
():
pass
# fail
cdef
void
__stdcall
h
err1
():
pass
# fail
@
cython
.
callspec
(
"__cdecl"
)
cdef
void
__fastcall
h6
():
pass
# fail
cdef
void
__fastcall
herr2
():
pass
# fail
# Pointer typedefs
ctypedef
void
(
*
PT1
)()
ctypedef
void
(
__cdecl
*
PT2
)()
ctypedef
void
(
__stdcall
*
PT3
)()
ctypedef
void
(
__fastcall
*
PT4
)()
ctypedef
USERTYPE
(
*
PT5
)()
ctypedef
USERTYPE
(
__cdecl
*
PT6
)()
ctypedef
USERTYPE
(
__stdcall
*
PT7
)()
ctypedef
USERTYPE
(
__fastcall
*
PT8
)()
# Pointers
cdef
void
(
*
p1
)()
cdef
void
(
__cdecl
*
p2
)()
cdef
void
(
__stdcall
*
p3
)()
cdef
void
(
__fastcall
*
p4
)()
cdef
USERTYPE
(
*
p5
)()
cdef
USERTYPE
(
__cdecl
*
p6
)()
cdef
USERTYPE
(
__stdcall
*
p7
)()
cdef
USERTYPE
(
__fastcall
*
p8
)()
cdef
PT1
pt1
cdef
PT2
pt2
cdef
PT3
pt3
cdef
PT4
pt4
cdef
PT5
pt5
cdef
PT6
pt6
cdef
PT7
pt7
cdef
PT8
pt8
# Assignments
p1
=
pt1
=
p2
=
pt2
=
h1
p1
=
pt1
=
p2
=
pt2
=
h2
p3
=
pt3
=
h3
p4
=
pt4
=
h4
p
1
=
h1
p
2
=
h2
p
3
=
h3
p
4
=
h4
p
5
=
pt5
=
p6
=
pt6
=
h5
p
5
=
pt5
=
p6
=
pt6
=
h6
p
7
=
pt7
=
h7
p
8
=
pt8
=
h8
#p1 = h2 # fail
#p1 = h3 # fail
...
...
@@ -39,8 +84,8 @@ p4 = h4
#p2 = h4 # fail
_ERRORS
=
u"""
18:22
: cannot have both '__stdcall' and '__cdecl' calling conventions
21:23
: cannot have both '__fastcall' and '__cdecl' calling conventions
30:25
: cannot have both '__stdcall' and '__cdecl' calling conventions
33:26
: cannot have both '__fastcall' and '__cdecl' calling conventions
"""
#31:14: Cannot assign type 'void (__cdecl )(void)' to 'void (*)(void)'
#32:14: Cannot assign type 'void (__stdcall )(void)' to 'void (*)(void)'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment