[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: 2006-12-29 08:27:00 CET

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

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)
+
     # 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")
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Dec 29 08:27:14 2006

This is an archived mail posted to the Subversion Dev mailing list.