You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kouhei Sutou <ko...@cozmixng.org> on 2006/12/29 07:27:00 UTC

[PATCH] header_wrappers.py generates 'return' for 'void' callback

Hi,

header_wrappers.py generates functions that invokes
callback. There is a small problem in
header_wrappers.py. header_wrappers.py always generates
'return CALLBACK(ARGS)' codes. But there are some callbacks
that returns 'void'. (e.g. svn_ra_progress_notify_func_t())

This behavior may not be serial problem but compiler may
output a warning. I found some warnings for this in Joe's
Ruby bindings build log.

[[
Do not generate 'return' for callbacks return 'void'.

* build/generator/swig/header_wrappers.py
  (_write_callback): Add 'return' only if return_type is not 'void'.
]]


Thanks,
--
kou

Re: [PATCH] header_wrappers.py generates 'return' for 'void' callback

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <20...@anvil.finemaltcoding.com>
  "Re: [PATCH] header_wrappers.py generates 'return' for 'void' callback" on Thu, 28 Dec 2006 23:48:27 -0800,
  Daniel Rall <dl...@collab.net> wrote:

> > [[
> > Do not generate 'return' for callbacks return 'void'.
> > 
> > * build/generator/swig/header_wrappers.py
> >   (_write_callback): Add 'return' only if return_type is not 'void'.
> > ]]

> Other than that, looks good.  +1 to commit.

Thanks.
I've committed in r22835.


Regards,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] header_wrappers.py generates 'return' for 'void' callback

Posted by Daniel Rall <dl...@collab.net>.
On Fri, 29 Dec 2006, Kouhei Sutou wrote:
...
> [[
> Do not generate 'return' for callbacks return 'void'.
> 
> * build/generator/swig/header_wrappers.py
>   (_write_callback): Add 'return' only if return_type is not 'void'.
> ]]
...
> Index: build/generator/swig/header_wrappers.py
> ===================================================================
> --- build/generator/swig/header_wrappers.py	(revision 22832)
> +++ build/generator/swig/header_wrappers.py	(working copy)
> @@ -84,11 +84,15 @@
>        param_names = string.join(self._re_param_names.findall(params), ", ")
>        params = "%s _obj, %s" % (type, params)
>  
> +    invoke_callback = "%s(%s)" % (callee, param_names)
> +    if return_type != "void":
> +      invoke_callback = "return %s" % (invoke_callback)
                                         ^               ^
You don't need the parenthesis around (invoke_callback).

>      # Write out the declaration
>      self.ofile.write(
>        "static %s %s_invoke_%s(\n" % (return_type, module, function) +
>        "  %s) {\n" % params +
> -      "  return %s(%s);\n" % (callee, param_names) +
> +      "  %s;\n" % (invoke_callback) +
>        "}\n\n")

Other than that, looks good.  +1 to commit.