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,
annotation = p_test(s)
if s.sy == '=':
s.next()
if 'pxd' in ctx.level and 'inline' not in ctx.modifiers:
if s.sy not in ['*', '?']:
error(pos, "default values cannot be specified in pxd files, use ? or *")
default = ExprNodes.BoolNode(1)
if 'pxd' in ctx.level:
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 *")
else:
default = p_test(s)
return Nodes.CArgDeclNode(pos,
......
......@@ -1319,6 +1319,9 @@ class ModuleScope(Scope):
def declare_cfunction(self, name, type, pos,
cname=None, visibility='private', api=0, in_pxd=0,
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.
if not cname:
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