diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index e3cfe5cf2c3c9bea1a0d911980c48b4f47858cd6..a440ee4c88f799ec032f4e2b356d61b27bcc2528 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -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 ['*', '?']: + 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 *") - default = ExprNodes.BoolNode(1) - s.next() else: default = p_test(s) return Nodes.CArgDeclNode(pos, diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index f0b1faad6e5db0e6f6f724c1dcbc92a237481c78..dda38b337dbbf0145500350f206661dd377a6729 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -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):