[sr-dev] app_python compilation warnings fix

Konstantin M. evilzluk at gmail.com
Mon Dec 3 00:56:10 CET 2012


Next patch for fixing:

CC (gcc) [M app_python.so]              python_msgobj.o
python_msgobj.c: In function ‘python_msgobj_init’:
python_msgobj.c:530:5: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]



2012/12/3 Konstantin M. <evilzluk at gmail.com>

> Hello dev team,
>
> I'm trying to compile app_python under kamailio 3.3.2 and gcc (Debian
> 4.7.2-4) 4.7.2 and I'm getting a bunch of warnings like:
> CC (gcc) [M app_python.so]              python_exec.o
> CC (gcc) [M app_python.so]              python_iface.o
> In file included from /usr/include/python2.7/Python.h:8:0,
>                  from python_iface.c:28:
> /usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE"
> redefined [enabled by default]
> In file included from /usr/include/i386-linux-gnu/sys/types.h:26:0,
>                  from ../../route_struct.h:45,
>                  from ../../action.h:42,
>                  from python_iface.c:23:
> /usr/include/features.h:214:0: note: this is the location of the previous
> definition
> CC (gcc) [M app_python.so]              python_mod.o
> In file included from /usr/include/python2.7/Python.h:8:0,
>                  from python_iface.h:26,
>                  from python_mod.c:27:
> /usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE"
> redefined [enabled by default]
> In file included from /usr/include/dlfcn.h:23:0,
>                  from ../../sr_module.h:60,
>                  from python_mod.c:24:
> /usr/include/features.h:214:0: note: this is the location of the previous
> definition
>
> ...
>
>
> According to the Python documentation (
> http://docs.python.org/c-api/intro.html#includes), the include directive
> for “Python.h” should appear first in the C/C++ file.
> It doesn’t sound like a good idea to require this, but if you don’t put
> “Python.h” first, you might get compiler warnings like I mentioned above.
>
> I've made a diff (against kamailio-3.3.2) for fixing that.
> See attached.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20121203/977d10bc/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dereferencing_warning_fix.diff
Type: application/octet-stream
Size: 585 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20121203/977d10bc/attachment-0001.obj>


More information about the sr-dev mailing list