Bug 402931 - "swig -c++ -r" generates bad code
"swig -c++ -r" generates bad code
Product: Fedora
Classification: Fedora
Component: swig (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Adam Tkac
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-11-28 10:06 EST by John Ellson
Modified: 2013-04-30 19:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-11-29 07:52:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description John Ellson 2007-11-28 10:06:42 EST
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):

How reproducible:

Steps to Reproduce:
1. grab attached: Makefile, gv.i
2. make
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 10:06:42 EST
Created attachment 271381 [details]
Comment 2 John Ellson 2007-11-28 10:07:55 EST
Created attachment 271391 [details]
gv.i swig source file
Comment 3 Adam Tkac 2007-11-29 04:02:19 EST
Looks like fixed in latest upstream. Could you please test
http://kojiweb.fedoraproject.org/koji/taskinfo?taskID=265131 ? Works for me.

Comment 4 Adam Tkac 2007-11-29 07:52:28 EST
after tests fixed in swig-1.3.33-1.fc{7,8,9}
Comment 5 John Ellson 2007-11-29 08:42:22 EST
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 09:07:00 EST
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


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