Share

SWIG

Tracker: Patches

5 Fix bug outputing "<:" token - ID: 1690948
Last Update: Comment added ( olly )

Small tweak to the SwigValueWrapper, it could output types like:

SwigValueWrapper<::foo > bar;

The "<:" token annoys GCC.

I copied from similar code found in stype.c to create this patch.

Note: the SwigType_alttype function has two main branches that have similar
code, in the first case it does:

if (use_wrapper) {
String *str = SwigType_str(td, 0);
w = NewStringf("SwigValueWrapper<%s >", str);
Delete(str);
}

and in the second case it does:

if (use_wrapper) {
w = NewStringf("SwigValueWrapper<%s >", td);
}

td is a SwigType* in both cases. The stringification of td in the second
case seemed suspicious to me so in my patch I changed the code to match the
use in the first case.

It looks like this function could be cleaned up further by pulling the
now-identical use_wrapper blocks out of the main if/else.


J Robert Ray ( jrray ) - 2007-03-29 23:01

5

Closed

Accepted

Olly Betts

None

None

Public


Comments ( 2 )

Date: 2007-03-30 02:53
Sender: olly


OK, applied.

I went for just always inserting a space between "<" and the type which is
simpler (it was actually me who changed stype.c - there I was concerned
that changing the strings generated might cause problems if some other part
of SWIG looked at the result - here it's more obvious that nothing does).

I factored out some of the common code too.

Using %s like this with a SwigType* is OK. If you look in
Source/Swig/swig.h, SwigType is a typedef for DOH, and so it just magically
gets converted to a string (see DohvPrintf() in Source/DOH/fio.c).


Date: 2007-03-29 23:18
Sender: olly


Thanks for the patch. I'm looking at applying it now...


Attached File ( 1 )

Filename Description Download
swig_token.patch Fix "<:" is "[" warning Download

Changes ( 5 )

Field Old Value Date By
status_id Open 2007-03-30 02:53 olly
resolution_id None 2007-03-30 02:53 olly
close_date - 2007-03-30 02:53 olly
assigned_to nobody 2007-03-29 23:18 olly
File Added 222904: swig_token.patch 2007-03-29 23:01 jrray