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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
f020a6d2
Commit
f020a6d2
authored
Nov 25, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cdef extern structs may be c++ classes, can refer to themselves
parent
779b34dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+17
-16
No files found.
Cython/Compiler/Nodes.py
View file @
f020a6d2
...
@@ -790,24 +790,25 @@ class CStructOrUnionDefNode(StatNode):
...
@@ -790,24 +790,25 @@ class CStructOrUnionDefNode(StatNode):
self
.
entry
.
defined_in_pxd
=
1
self
.
entry
.
defined_in_pxd
=
1
for
attr
in
self
.
attributes
:
for
attr
in
self
.
attributes
:
attr
.
analyse_declarations
(
env
,
scope
)
attr
.
analyse_declarations
(
env
,
scope
)
for
attr
in
scope
.
var_entries
:
if
self
.
visibility
!=
'extern'
:
type
=
attr
.
type
for
attr
in
scope
.
var_entries
:
while
type
.
is_array
:
type
=
attr
.
type
type
=
type
.
base_type
while
type
.
is_array
:
if
type
==
self
.
entry
.
type
:
error
(
attr
.
pos
,
"Struct cannot contain itself as a member."
)
if
self
.
typedef_flag
:
while
type
.
is_ptr
:
type
=
type
.
base_type
type
=
type
.
base_type
if
type
==
self
.
entry
.
type
:
if
type
==
self
.
entry
.
type
:
need_typedef_indirection
=
True
error
(
attr
.
pos
,
"Struct cannot contain itself as a member."
)
if
need_typedef_indirection
and
self
.
visibility
!=
'extern'
:
if
self
.
typedef_flag
:
# C can't handle typedef structs that refer to themselves.
while
type
.
is_ptr
:
struct_entry
=
self
.
entry
type
=
type
.
base_type
cname
=
env
.
new_const_cname
()
if
type
==
self
.
entry
.
type
:
self
.
entry
=
env
.
declare_typedef
(
self
.
name
,
struct_entry
.
type
,
self
.
pos
,
cname
=
self
.
cname
,
visibility
=
'ignore'
)
need_typedef_indirection
=
True
struct_entry
.
type
.
typedef_flag
=
False
if
need_typedef_indirection
:
struct_entry
.
cname
=
struct_entry
.
type
.
cname
=
env
.
new_const_cname
()
# C can't handle typedef structs that refer to themselves.
struct_entry
=
self
.
entry
cname
=
env
.
new_const_cname
()
self
.
entry
=
env
.
declare_typedef
(
self
.
name
,
struct_entry
.
type
,
self
.
pos
,
cname
=
self
.
cname
,
visibility
=
'ignore'
)
struct_entry
.
type
.
typedef_flag
=
False
struct_entry
.
cname
=
struct_entry
.
type
.
cname
=
env
.
new_const_cname
()
def
analyse_expressions
(
self
,
env
):
def
analyse_expressions
(
self
,
env
):
pass
pass
...
...
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