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
Xavier Thompson
cython
Commits
f871cad3
Commit
f871cad3
authored
Jul 31, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't initialize unused cdef-function optional args
parent
594e3bad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
Cython/Compiler/FlowControl.py
Cython/Compiler/FlowControl.py
+1
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+21
-9
No files found.
Cython/Compiler/FlowControl.py
View file @
f871cad3
...
...
@@ -523,7 +523,6 @@ def check_definitions(flow, compiler_directives):
if
is_arg
:
if
warn_unused_arg
:
messages
.
warning
(
entry
.
pos
,
"Unused argument '%s'"
%
entry
.
name
)
entry
.
cf_used
=
False
else
:
if
warn_unused
:
messages
.
warning
(
entry
.
pos
,
"Unused entry '%s'"
%
entry
.
name
)
...
...
Cython/Compiler/Nodes.py
View file @
f871cad3
...
...
@@ -1828,8 +1828,11 @@ class CFuncDefNode(FuncDefNode):
code
.
putln
(
"%s%s%s {"
%
(
storage_class
,
modifiers
,
header
))
def
generate_argument_declarations
(
self
,
env
,
code
):
scope
=
self
.
local_scope
for
arg
in
self
.
args
:
if
arg
.
default
:
entry
=
scope
.
lookup
(
arg
.
name
)
if
entry
.
cf_used
:
result
=
arg
.
calculate_default_value_code
(
code
)
code
.
putln
(
'%s = %s;'
%
(
arg
.
type
.
declaration_code
(
arg
.
cname
),
result
))
...
...
@@ -1839,17 +1842,26 @@ class CFuncDefNode(FuncDefNode):
def
generate_argument_parsing_code
(
self
,
env
,
code
):
i
=
0
used
=
0
if
self
.
type
.
optional_arg_count
:
scope
=
self
.
local_scope
code
.
putln
(
'if (%s) {'
%
Naming
.
optional_args_cname
)
for
arg
in
self
.
args
:
if
arg
.
default
:
code
.
putln
(
'if (%s->%sn > %s) {'
%
(
Naming
.
optional_args_cname
,
Naming
.
pyrex_prefix
,
i
))
entry
=
scope
.
lookup
(
arg
.
name
)
if
entry
.
cf_used
:
code
.
putln
(
'if (%s->%sn > %s) {'
%
(
Naming
.
optional_args_cname
,
Naming
.
pyrex_prefix
,
i
))
declarator
=
arg
.
declarator
while
not
hasattr
(
declarator
,
'name'
):
declarator
=
declarator
.
base
code
.
putln
(
'%s = %s->%s;'
%
(
arg
.
cname
,
Naming
.
optional_args_cname
,
self
.
type
.
opt_arg_cname
(
declarator
.
name
)))
code
.
putln
(
'%s = %s->%s;'
%
(
arg
.
cname
,
Naming
.
optional_args_cname
,
self
.
type
.
opt_arg_cname
(
declarator
.
name
)))
used
+=
1
i
+=
1
for
_
in
range
(
self
.
type
.
optional_arg_count
):
for
_
in
range
(
used
):
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
...
...
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