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
19ec8ac4
Commit
19ec8ac4
authored
Aug 28, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove const qualifiers from generated code for cypclass methods
parent
4cf301a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-0
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+6
-4
Cython/Utility/CyObjects.cpp
Cython/Utility/CyObjects.cpp
+5
-5
No files found.
Cython/Compiler/Nodes.py
View file @
19ec8ac4
...
@@ -2680,6 +2680,7 @@ class CFuncDefNode(FuncDefNode):
...
@@ -2680,6 +2680,7 @@ class CFuncDefNode(FuncDefNode):
typ
.
is_const_method
=
self
.
is_const_method
typ
.
is_const_method
=
self
.
is_const_method
typ
.
is_static_method
=
self
.
is_static_method
typ
.
is_static_method
=
self
.
is_static_method
typ
.
is_cyp_class_method
=
self
.
is_cyp_class_method
self
.
entry
=
env
.
declare_cfunction
(
self
.
entry
=
env
.
declare_cfunction
(
name
,
typ
,
self
.
pos
,
name
,
typ
,
self
.
pos
,
...
...
Cython/Compiler/PyrexTypes.py
View file @
19ec8ac4
...
@@ -1840,8 +1840,6 @@ class CConstOrVolatileType(BaseType):
...
@@ -1840,8 +1840,6 @@ class CConstOrVolatileType(BaseType):
def
cv_string
(
self
):
def
cv_string
(
self
):
cvstring
=
""
cvstring
=
""
if
self
.
is_cyp_class
:
return
cvstring
if
self
.
is_const
:
if
self
.
is_const
:
cvstring
=
"const "
+
cvstring
cvstring
=
"const "
+
cvstring
if
self
.
is_volatile
:
if
self
.
is_volatile
:
...
@@ -1857,6 +1855,8 @@ class CConstOrVolatileType(BaseType):
...
@@ -1857,6 +1855,8 @@ class CConstOrVolatileType(BaseType):
def
declaration_code
(
self
,
entity_code
,
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
cv
=
self
.
cv_string
()
cv
=
self
.
cv_string
()
if
self
.
is_cyp_class
and
not
for_display
:
cv
=
""
if
for_display
or
pyrex
:
if
for_display
or
pyrex
:
return
cv
+
self
.
cv_base_type
.
declaration_code
(
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
return
cv
+
self
.
cv_base_type
.
declaration_code
(
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
else
:
else
:
...
@@ -2926,12 +2926,14 @@ class CFuncType(CType):
...
@@ -2926,12 +2926,14 @@ class CFuncType(CType):
# (used for optimisation overrides)
# (used for optimisation overrides)
# is_const_method boolean
# is_const_method boolean
# is_static_method boolean
# is_static_method boolean
# is_cyp_class_method boolean
is_cfunction
=
1
is_cfunction
=
1
original_sig
=
None
original_sig
=
None
cached_specialized_types
=
None
cached_specialized_types
=
None
from_fused
=
False
from_fused
=
False
is_const_method
=
False
is_const_method
=
False
is_cyp_class_method
=
False
subtypes
=
[
'return_type'
,
'args'
]
subtypes
=
[
'return_type'
,
'args'
]
...
@@ -3282,7 +3284,7 @@ class CFuncType(CType):
...
@@ -3282,7 +3284,7 @@ class CFuncType(CType):
if
(
not
entity_code
and
cc
)
or
entity_code
.
startswith
(
"*"
):
if
(
not
entity_code
and
cc
)
or
entity_code
.
startswith
(
"*"
):
entity_code
=
"(%s%s)"
%
(
cc
,
entity_code
)
entity_code
=
"(%s%s)"
%
(
cc
,
entity_code
)
cc
=
""
cc
=
""
if
self
.
is_const_method
:
if
self
.
is_const_method
and
(
not
self
.
is_cyp_class_method
or
for_display
)
:
trailer
+=
" const"
trailer
+=
" const"
return
"%s%s(%s)%s"
%
(
cc
,
entity_code
,
arg_decl_code
,
trailer
)
return
"%s%s(%s)%s"
%
(
cc
,
entity_code
,
arg_decl_code
,
trailer
)
...
@@ -3293,7 +3295,7 @@ class CFuncType(CType):
...
@@ -3293,7 +3295,7 @@ class CFuncType(CType):
return
self
.
return_type
.
declaration_code
(
declarator_code
,
for_display
,
dll_linkage
,
pyrex
)
return
self
.
return_type
.
declaration_code
(
declarator_code
,
for_display
,
dll_linkage
,
pyrex
)
def
function_header_code
(
self
,
func_name
,
arg_code
):
def
function_header_code
(
self
,
func_name
,
arg_code
):
if
self
.
is_const_method
:
if
self
.
is_const_method
and
not
self
.
is_cyp_class_method
:
trailer
=
" const"
trailer
=
" const"
else
:
else
:
trailer
=
""
trailer
=
""
...
...
Cython/Utility/CyObjects.cpp
View file @
19ec8ac4
...
@@ -134,9 +134,9 @@
...
@@ -134,9 +134,9 @@
struct
ActhonResultInterface
:
public
CyObject
{
struct
ActhonResultInterface
:
public
CyObject
{
virtual
void
pushVoidStarResult
(
void
*
result
)
=
0
;
virtual
void
pushVoidStarResult
(
void
*
result
)
=
0
;
virtual
void
*
getVoidStarResult
()
const
=
0
;
virtual
void
*
getVoidStarResult
()
=
0
;
virtual
void
pushIntResult
(
int
result
)
=
0
;
virtual
void
pushIntResult
(
int
result
)
=
0
;
virtual
int
getIntResult
()
const
=
0
;
virtual
int
getIntResult
()
=
0
;
operator
int
()
{
return
this
->
getIntResult
();
}
operator
int
()
{
return
this
->
getIntResult
();
}
operator
void
*
()
{
return
this
->
getVoidStarResult
();
}
operator
void
*
()
{
return
this
->
getVoidStarResult
();
}
};
};
...
@@ -144,8 +144,8 @@
...
@@ -144,8 +144,8 @@
struct
ActhonMessageInterface
;
struct
ActhonMessageInterface
;
struct
ActhonSyncInterface
:
public
CyObject
{
struct
ActhonSyncInterface
:
public
CyObject
{
virtual
int
isActivable
()
const
=
0
;
virtual
int
isActivable
()
=
0
;
virtual
int
isCompleted
()
const
=
0
;
virtual
int
isCompleted
()
=
0
;
virtual
void
insertActivity
(
ActhonMessageInterface
*
msg
)
=
0
;
virtual
void
insertActivity
(
ActhonMessageInterface
*
msg
)
=
0
;
virtual
void
removeActivity
(
ActhonMessageInterface
*
msg
)
=
0
;
virtual
void
removeActivity
(
ActhonMessageInterface
*
msg
)
=
0
;
};
};
...
@@ -161,7 +161,7 @@
...
@@ -161,7 +161,7 @@
struct
ActhonQueueInterface
:
public
CyObject
{
struct
ActhonQueueInterface
:
public
CyObject
{
virtual
void
push
(
ActhonMessageInterface
*
message
)
=
0
;
virtual
void
push
(
ActhonMessageInterface
*
message
)
=
0
;
virtual
int
activate
()
=
0
;
virtual
int
activate
()
=
0
;
virtual
int
is_empty
()
const
=
0
;
virtual
int
is_empty
()
=
0
;
};
};
struct
ActhonActivableClass
:
public
CyObject
{
struct
ActhonActivableClass
:
public
CyObject
{
...
...
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