Commit 593ddc79 authored by Robert Bradshaw's avatar Robert Bradshaw

Make inline declarations into a warning.

This fixes the regression at #1706 and will become an error with #1736.
parent f0f6ec36
...@@ -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 ['*', '?']:
# TODO(github/1736): Make this an error for inline declarations.
default = ExprNodes.NoneNode(pos)
s.next()
elif 'inline' in ctx.modifiers:
default = p_test(s)
else:
error(pos, "default values cannot be specified in pxd files, use ? or *") error(pos, "default values cannot be specified in pxd files, use ? or *")
default = ExprNodes.BoolNode(1)
s.next()
else: else:
default = p_test(s) default = p_test(s)
return Nodes.CArgDeclNode(pos, return Nodes.CArgDeclNode(pos,
......
...@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment