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

Re: [PATCH] Fix build errors in bindings with SWIG 3.0.4

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 29 Jan 2015 16:40:09 +0000

Andreas Stieger <andreas.stieger_at_gmx.de> writes:

> Hi,
>
> On 29/01/15 16:05, Philip Martin wrote:
>> Andreas Stieger <andreas.stieger_at_gmx.de> writes:
>>
>>> When removing comments which throw SWIG 3.0.4 errors as this:
>>
>> What errors do you get if you leave the comments in? We don't really
>> want to delete the comments from our source code.
>
>> [ 479s] ./subversion/bindings/swig/core.i:792: Error: Unknown SWIG preprocessor directive: The (if this is a block of target language code, delimit it with %{ and %})
>> [ 479s] ./subversion/bindings/swig/core.i:793: Error: Unknown SWIG preprocessor directive: reference (if this is a block of target language code, delimit it with %{ and %})
>> [ 479s] ./subversion/bindings/swig/core.i:794: Error: Unknown SWIG preprocessor directive: references (if this is a block of target language code, delimit it with %{ and %})
>> [ 479s] ./subversion/bindings/swig/core.i:795: Error: Unknown SWIG preprocessor directive: keeping (if this is a block of target language code, delimit it with %{ and %})
>> [ 479s] /home/abuild/rpmbuild/BUILD/subversion-1.8.11/subversion/bindings/swig/include/proxy.swg:86: Error: Unknown SWIG preprocessor directive: If (if this is a block of target language code, delimit it with %{ and %})
>> [ 479s] /home/abuild/rpmbuild/BUILD/subversion-1.8.11/subversion/bindings/swig/include/proxy.swg:87: Error: Unknown SWIG preprocessor directive: metadata (if this is a block of target language code, delimit it with %{ and %})

So it appears that the SWIG preprocessor is different between 2.0 and
3.0. Rather than remove the comments we could mark them like below.
This works with my 2.0.7, does it work for you? (With both # and %# the
comments are not present in the generated files with my 2.0.7.)

Index: subversion/bindings/swig/include/proxy.swg
===================================================================
--- subversion/bindings/swig/include/proxy.swg (revision 1655672)
+++ subversion/bindings/swig/include/proxy.swg (working copy)
@@ -83,13 +83,13 @@
 
     value = _swig_getattr(self, self.__class__, name)
 
- # If we got back a different object than we have, we need to copy all our
- # metadata into it, so that it looks identical
+ %# If we got back a different object than we have, we need to copy all our
+ %# metadata into it, so that it looks identical
     members = self.__dict__.get("_members")
     if members is not None:
       _copy_metadata_deep(value, members.get(name))
         
- # Verify that the new object is good
+ %# Verify that the new object is good
     _assert_valid_deep(value)
 
     return value
@@ -98,9 +98,9 @@
     """Set an attribute on this object"""
     self.assert_valid()
 
- # Save a copy of the object, so that the garbage
- # collector won't kill the object while it's in
- # SWIG-land
+ %# Save a copy of the object, so that the garbage
+ %# collector won't kill the object while it's in
+ %# SWIG-land
     self.__dict__.setdefault("_members",{})[name] = value
 
     return _swig_setattr(self, self.__class__, name, value)
Index: subversion/bindings/swig/svn_delta.i
===================================================================
--- subversion/bindings/swig/svn_delta.i (revision 1655672)
+++ subversion/bindings/swig/svn_delta.i (working copy)
@@ -206,8 +206,8 @@ void _ops_get(int *num_ops, const svn_txdelta_op_t
 
 #ifdef SWIGPYTHON
 %pythoncode {
-# This function is for backwards compatibility only.
-# Use svn_txdelta_window_t.ops instead.
+%# This function is for backwards compatibility only.
+%# Use svn_txdelta_window_t.ops instead.
 svn_txdelta_window_t_ops_get = svn_txdelta_window_t._ops_get
 }
 #endif

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*
Received on 2015-01-29 17:42:55 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.