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
593ddc79
Commit
593ddc79
authored
Jun 15, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make inline declarations into a warning.
This fixes the regression at #1706 and will become an error with #1736.
parent
f0f6ec36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+8
-4
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+3
-0
No files found.
Cython/Compiler/Parsing.py
View file @
593ddc79
...
@@ -2963,11 +2963,15 @@ def p_c_arg_decl(s, ctx, in_pyfunc, cmethod_flag = 0, nonempty = 0,
...
@@ -2963,11 +2963,15 @@ def p_c_arg_decl(s, ctx, in_pyfunc, cmethod_flag = 0, nonempty = 0,
annotation
=
p_test
(
s
)
annotation
=
p_test
(
s
)
if
s
.
sy
==
'='
:
if
s
.
sy
==
'='
:
s
.
next
()
s
.
next
()
if
'pxd'
in
ctx
.
level
and
'inline'
not
in
ctx
.
modifiers
:
if
'pxd'
in
ctx
.
level
:
if
s
.
sy
not
in
[
'*'
,
'?'
]:
if
s
.
sy
in
[
'*'
,
'?'
]:
error
(
pos
,
"default values cannot be specified in pxd files, use ? or *"
)
# TODO(github/1736): Make this an error for inline declarations.
default
=
ExprNodes
.
BoolNode
(
1
)
default
=
ExprNodes
.
NoneNode
(
pos
)
s
.
next
()
s
.
next
()
elif
'inline'
in
ctx
.
modifiers
:
default
=
p_test
(
s
)
else
:
error
(
pos
,
"default values cannot be specified in pxd files, use ? or *"
)
else
:
else
:
default
=
p_test
(
s
)
default
=
p_test
(
s
)
return
Nodes
.
CArgDeclNode
(
pos
,
return
Nodes
.
CArgDeclNode
(
pos
,
...
...
Cython/Compiler/Symtab.py
View file @
593ddc79
...
@@ -1319,6 +1319,9 @@ class ModuleScope(Scope):
...
@@ -1319,6 +1319,9 @@ class ModuleScope(Scope):
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
def
declare_cfunction
(
self
,
name
,
type
,
pos
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
cname
=
None
,
visibility
=
'private'
,
api
=
0
,
in_pxd
=
0
,
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
):
defining
=
0
,
modifiers
=
(),
utility_code
=
None
,
overridable
=
False
):
if
not
defining
and
'inline'
in
modifiers
:
# TODO(github/1736): Make this an error.
warning
(
pos
,
"Declarations should not be declared inline."
,
1
)
# Add an entry for a C function.
# Add an entry for a C function.
if
not
cname
:
if
not
cname
:
if
visibility
==
'extern'
or
(
visibility
==
'public'
and
defining
):
if
visibility
==
'extern'
or
(
visibility
==
'public'
and
defining
):
...
...
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