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
Gwenaël Samain
cython
Commits
f61e9124
Commit
f61e9124
authored
Nov 25, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix gcc crash on recursive typedef struct
Won't break existing code, only makes bad code compile now.
parent
a81796ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+19
-0
tests/compile/ctypedefstruct.pyx
tests/compile/ctypedefstruct.pyx
+3
-0
No files found.
Cython/Compiler/Nodes.py
View file @
f61e9124
...
@@ -784,11 +784,30 @@ class CStructOrUnionDefNode(StatNode):
...
@@ -784,11 +784,30 @@ class CStructOrUnionDefNode(StatNode):
self
.
entry
=
env
.
declare_struct_or_union
(
self
.
entry
=
env
.
declare_struct_or_union
(
self
.
name
,
self
.
kind
,
scope
,
self
.
typedef_flag
,
self
.
pos
,
self
.
name
,
self
.
kind
,
scope
,
self
.
typedef_flag
,
self
.
pos
,
self
.
cname
,
visibility
=
self
.
visibility
)
self
.
cname
,
visibility
=
self
.
visibility
)
need_typedef_indirection
=
False
if
self
.
attributes
is
not
None
:
if
self
.
attributes
is
not
None
:
if
self
.
in_pxd
and
not
env
.
in_cinclude
:
if
self
.
in_pxd
and
not
env
.
in_cinclude
:
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
:
type
=
attr
.
type
while
type
.
is_array
:
type
=
type
.
base_type
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
if
type
==
self
.
entry
.
type
:
need_typedef_indirection
=
True
if
need_typedef_indirection
and
self
.
visibility
!=
'extern'
:
# 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
...
...
tests/compile/ctypedefstruct.pyx
View file @
f61e9124
...
@@ -7,3 +7,6 @@ cdef order order1
...
@@ -7,3 +7,6 @@ cdef order order1
order1
.
spam
=
7
order1
.
spam
=
7
order1
.
eggs
=
2
order1
.
eggs
=
2
ctypedef
struct
linked
:
int
a
linked
*
next
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