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
d9b3c477
Commit
d9b3c477
authored
Apr 24, 2014
by
Alok Singhal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename "switchcase_transform" to "use_switch"
parent
48559415
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
18 deletions
+9
-18
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+5
-5
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+1
-1
tests/errors/e_switch_transform.pyx
tests/errors/e_switch_transform.pyx
+2
-2
tests/errors/includes/e_switch_transform_support.h
tests/errors/includes/e_switch_transform_support.h
+0
-9
tests/run/switch_transform.pyx
tests/run/switch_transform.pyx
+1
-1
No files found.
Cython/Compiler/Optimize.py
View file @
d9b3c477
...
@@ -917,7 +917,7 @@ class SwitchTransform(Visitor.CythonTransform):
...
@@ -917,7 +917,7 @@ class SwitchTransform(Visitor.CythonTransform):
return
False
return
False
def
visit_IfStatNode
(
self
,
node
):
def
visit_IfStatNode
(
self
,
node
):
if
not
self
.
current_directives
.
get
(
'optimize.
switchcase_transform
'
):
if
not
self
.
current_directives
.
get
(
'optimize.
use_switch
'
):
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
return
node
return
node
...
@@ -950,7 +950,7 @@ class SwitchTransform(Visitor.CythonTransform):
...
@@ -950,7 +950,7 @@ class SwitchTransform(Visitor.CythonTransform):
return
switch_node
return
switch_node
def
visit_CondExprNode
(
self
,
node
):
def
visit_CondExprNode
(
self
,
node
):
if
not
self
.
current_directives
.
get
(
'optimize.
switchcase_transform
'
):
if
not
self
.
current_directives
.
get
(
'optimize.
use_switch
'
):
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
return
node
return
node
...
@@ -966,7 +966,7 @@ class SwitchTransform(Visitor.CythonTransform):
...
@@ -966,7 +966,7 @@ class SwitchTransform(Visitor.CythonTransform):
node
.
true_val
,
node
.
false_val
)
node
.
true_val
,
node
.
false_val
)
def
visit_BoolBinopNode
(
self
,
node
):
def
visit_BoolBinopNode
(
self
,
node
):
if
not
self
.
current_directives
.
get
(
'optimize.
switchcase_transform
'
):
if
not
self
.
current_directives
.
get
(
'optimize.
use_switch
'
):
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
return
node
return
node
...
@@ -984,7 +984,7 @@ class SwitchTransform(Visitor.CythonTransform):
...
@@ -984,7 +984,7 @@ class SwitchTransform(Visitor.CythonTransform):
ExprNodes
.
BoolNode
(
node
.
pos
,
value
=
False
,
constant_result
=
False
))
ExprNodes
.
BoolNode
(
node
.
pos
,
value
=
False
,
constant_result
=
False
))
def
visit_PrimaryCmpNode
(
self
,
node
):
def
visit_PrimaryCmpNode
(
self
,
node
):
if
not
self
.
current_directives
.
get
(
'optimize.
switchcase_transform
'
):
if
not
self
.
current_directives
.
get
(
'optimize.
use_switch
'
):
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
return
node
return
node
...
@@ -1031,7 +1031,7 @@ class SwitchTransform(Visitor.CythonTransform):
...
@@ -1031,7 +1031,7 @@ class SwitchTransform(Visitor.CythonTransform):
return
replacement
return
replacement
def
visit_EvalWithTempExprNode
(
self
,
node
):
def
visit_EvalWithTempExprNode
(
self
,
node
):
if
not
self
.
current_directives
.
get
(
'optimize.
switchcase_transform
'
):
if
not
self
.
current_directives
.
get
(
'optimize.
use_switch
'
):
self
.
visitchildren
(
node
)
self
.
visitchildren
(
node
)
return
node
return
node
...
...
Cython/Compiler/Options.py
View file @
d9b3c477
...
@@ -129,7 +129,7 @@ directive_defaults = {
...
@@ -129,7 +129,7 @@ directive_defaults = {
# optimizations
# optimizations
'optimize.inline_defnode_calls'
:
True
,
'optimize.inline_defnode_calls'
:
True
,
'optimize.
switchcase_transform
'
:
True
,
'optimize.
use_switch
'
:
True
,
# remove unreachable code
# remove unreachable code
'remove_unreachable'
:
True
,
'remove_unreachable'
:
True
,
...
...
tests/errors/e_switch_transform.pyx
View file @
d9b3c477
# cython: optimize.
switchcase_transform
=True
# cython: optimize.
use_switch
=True
# mode: error
# mode: error
import
cython
import
cython
cdef
extern
from
"
includes/e_
switch_transform_support.h"
:
cdef
extern
from
"
../run/includes/
switch_transform_support.h"
:
enum
:
enum
:
ONE
ONE
ONE_AGAIN
ONE_AGAIN
...
...
tests/errors/includes/e_switch_transform_support.h
deleted
100644 → 0
View file @
48559415
#ifndef E_SWITCH_TRANSFORM_SUPPORT_H_
#define E_SWITCH_TRANSFORM_SUPPORT_H_ 1
enum
{
ONE
=
1
,
ONE_AGAIN
=
1
};
#endif
/* E_SWITCH_TRANSFORM_SUPPORT_H_ */
tests/run/switch_transform.pyx
View file @
d9b3c477
# cython: optimize.
switchcase_transform
=False
# cython: optimize.
use_switch
=False
cdef
extern
from
"includes/switch_transform_support.h"
:
cdef
extern
from
"includes/switch_transform_support.h"
:
enum
:
enum
:
...
...
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