Bug 402931 - "swig -c++ -r" generates bad code
Summary: "swig -c++ -r" generates bad code
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: swig
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Adam Tkac
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-11-28 15:06 UTC by John Ellson
Modified: 2013-04-30 23:37 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2007-11-29 12:52:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Makefile (157 bytes, text/plain)
2007-11-28 15:06 UTC, John Ellson
no flags Details
gv.i swig source file (7.27 KB, text/plain)
2007-11-28 15:07 UTC, John Ellson
no flags Details

Description John Ellson 2007-11-28 15:06:42 UTC
Description of problem:
I'm trying to write a language binding for R for graphviz.   I'm successfully
using swig to generate ~10 other language bindings.

"swig -c++ -r gv.i"  generates bad code:
   - Missing:  #include <stdlib.h> 
   - error: invalid conversion from ‘const char*’ to ‘char*’
   - error: invalid conversion from ‘void*’ to ‘char*’


Version-Release number of selected component (if applicable):
swig-1.3.31-1.fc8.x86_64
gcc-c++-4.1.2-34.x86_64
R-2.6.1-1.fc9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. grab attached: Makefile, gv.i
2. make
3.
  
Actual results:
gv_r.cpp: In function ‘RCallbackFunctionData*
R_SWIG_pushCallbackFunctionData(SEXPREC*, SEXPREC*)’:
gv_r.cpp:759: error: ‘calloc’ was not declared in this scope
gv_r.cpp: In function ‘void R_SWIG_popCallbackFunctionData(int)’:
gv_r.cpp:800: error: ‘free’ was not declared in this scope
gv_r.cpp: In function ‘void R_SWIG_ReferenceFinalizer(SEXPREC*)’:
gv_r.cpp:888: error: ‘free’ was not declared in this scope
gv_r.cpp: In function ‘SEXPREC* RSwigPacked_New(void*, size_t, swig_type_info*)’:
gv_r.cpp:1000: error: ‘malloc’ was not declared in this scope
gv_r.cpp: In function ‘int SWIG_AsCharPtrAndSize(SEXPREC*, char**, size_t*, int*)’:
gv_r.cpp:1393: error: invalid conversion from ‘const char*’ to ‘char*’
....


Expected results:
no errors or warnings from swig generated code

Additional info:

Comment 1 John Ellson 2007-11-28 15:06:42 UTC
Created attachment 271381 [details]
Makefile

Comment 2 John Ellson 2007-11-28 15:07:55 UTC
Created attachment 271391 [details]
gv.i swig source file

Comment 3 Adam Tkac 2007-11-29 09:02:19 UTC
Looks like fixed in latest upstream. Could you please test
http://kojiweb.fedoraproject.org/koji/taskinfo?taskID=265131 ? Works for me.

Thanks

Comment 4 Adam Tkac 2007-11-29 12:52:28 UTC
after tests fixed in swig-1.3.33-1.fc{7,8,9}

Comment 5 John Ellson 2007-11-29 13:42:22 UTC
Much better, thanks.    Also no apparent new breakage to the other
swig-generated language bindings for graphviz.

    gv_r.cpp:725:2: warning: #warning "R Swig currently fails on runtime for 2.6
and higher."
   gv_r.cpp:726:2: warning: #warning "Contact maintainer if you would like to
help fix"

When I understand what this is about I'll take it up with the R maintainer.

Comment 6 Adam Tkac 2007-11-29 14:07:00 UTC
I'm not sure what exactly that warning mean. Tell it to R maintainer and if he
tells this is swig problem let me know

Thanks


Note You need to log in before you can comment on or make changes to this bug.