Package: swig
Version: 1.3.31-1
Severity: wishlist

Hi,

Compiling swig wrappers with my usual list of warnings enabled makes a
bit of noise that should be fairly easy to fix.  Changing the C casts
that remove constness from (char*)X to const_cast<char*>(X) should
silence most of them.  The 'format not a string literal and no format
arguments' ones mean something like printf(string_variable) should be
replaced with printf("%s", string_variable) instead.  The rest should
be fairly self evident on their own.

I haven't provided a patch, since there are surely more of these
for the wrapper types I haven't tried and in library functions I haven't
used, but the build logs for a simple 'hello_world()' interface are
included below to indicate the first few.

It would be nice to not have to disable some useful warnings to build
this code, and the format string warnings may have real implications.

Cheers,
Ron


swig -perl -c++ -o perl-foo_wrap.cpp foo.i
g++ -c -MMD -fPIC -I./include   -I/usr/lib/perl/5.8/CORE -pipe -O2 -Wall -W 
-Wpointer-arith -Wcast-qual -Wcast-align -Wformat=2 -Wno-format-nonliteral 
-Wfloat-equal -Woverloaded-virtual   -o perl-foo_wrap.o perl-foo_wrap.cpp
perl-foo_wrap.cpp: In function ‘swig_cast_info* SWIG_TypeProxyCheck(const 
char*, swig_type_info*)’:
perl-foo_wrap.cpp:1067: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp: In function ‘void SWIG_Perl_MakePtr(SV*, void*, 
swig_type_info*, int)’:
perl-foo_wrap.cpp:1161: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp:1179: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp: In function ‘void boot_foo(PerlInterpreter*, CV*)’:
perl-foo_wrap.cpp:1777: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp:1777: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp:1783: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp:1789: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp:1795: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
perl-foo_wrap.cpp:1770: warning: unused variable ‘items’
g++    -shared -o perl/foo.so foo.o perl-foo_wrap.o  


swig -python -c++ -o python-foo_wrap.cpp foo.i
g++ -c -MMD -fPIC -I./include   -I/usr/include/python2.4 -pipe -O2 -Wall -W 
-Wpointer-arith -Wcast-qual -Wcast-align -Wformat=2 -Wno-format-nonliteral 
-Wfloat-equal -Woverloaded-virtual   -o python-foo_wrap.o python-foo_wrap.cpp
python-foo_wrap.cpp: In function ‘void SWIG_Python_AddErrorMsg(const char*)’:
python-foo_wrap.cpp:870: warning: format not a string literal and no format 
arguments
python-foo_wrap.cpp: In function ‘void SWIG_Python_SetErrorMsg(PyObject*, const 
char*)’:
python-foo_wrap.cpp:1048: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘void SWIG_Python_SetConstant(PyObject*, const 
char*, PyObject*)’:
python-foo_wrap.cpp:1058: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘PySwigClientData* 
PySwigClientData_New(PyObject*)’:
python-foo_wrap.cpp:1265: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1277: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘PyObject* PySwigObject_own(PyObject*, 
PyObject*)’:
python-foo_wrap.cpp:1523: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: At global scope:
python-foo_wrap.cpp:1554: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1554: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1555: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1555: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1556: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1556: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1557: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1557: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1558: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1558: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1559: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:1559: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘PyTypeObject* _PySwigObject_type()’:
python-foo_wrap.cpp:1625: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘PyTypeObject* _PySwigPacked_type()’:
python-foo_wrap.cpp:1792: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘void SWIG_Python_SetSwigThis(PyObject*, 
PyObject*)’:
python-foo_wrap.cpp:2178: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘PyObject* 
SWIG_Python_InitShadowInstance(PyObject*)’:
python-foo_wrap.cpp:2187: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘swig_module_info* SWIG_Python_GetModule()’:
python-foo_wrap.cpp:2244: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:2245: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘void 
SWIG_Python_SetModule(swig_module_info*)’:
python-foo_wrap.cpp:2307: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp:2311: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘const char* PySwigObject_GetDesc(PyObject*)’:
python-foo_wrap.cpp:2396: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘PyObject* _wrap_hello_perl(PyObject*, 
PyObject*)’:
python-foo_wrap.cpp:2568: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: At global scope:
python-foo_wrap.cpp:2578: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘PyTypeObject* swig_varlink_type()’:
python-foo_wrap.cpp:2942: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
python-foo_wrap.cpp: In function ‘void init_foo()’:
python-foo_wrap.cpp:3108: warning: cast from type ‘const char*’ to type ‘char*’ 
casts away constness
g++    -shared -o python/_foo.so foo.o python-foo_wrap.o  


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to