classification
Title: warning '"_POSIX_C_SOURCE" redefined' when include Python.h
Type: Stage:
Components: Extension Modules Versions: Python 2.3
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: eugene_beast, loewis (2)
Priority: normal Keywords:

Created on 2004-10-13 05:06 by eugene_beast, last changed 2004-10-20 06:26 by loewis.

Messages (4)
msg22666 - (view) Author: Eugene Sizikov (eugene_beast) Date: 2004-10-13 05:06
"""
In file included from /usr/include/python2.3/Python.h:8,
                 from script.h:21,
                 from server.cpp:23:
/usr/include/python2.3/pyconfig.h:847:1: warning:
"_POSIX_C_SOURCE" redefined
In file included from
/usr/lib/gcc/i386-redhat-linux/3.4.0/../../../../include/c++/3.4.0/i386-redhat-linux/bits/os_defines.h:39,
                 from
/usr/lib/gcc/i386-redhat-linux/3.4.0/../../../../include/c++/3.4.0/i386-redhat-linux/bits/c++config.h:35,
                 from
/usr/lib/gcc/i386-redhat-linux/3.4.0/../../../../include/c++/3.4.0/iostream:44,
                 from server.cpp:18:
/usr/include/features.h:131:1: warning: this is the
location of the previous definition
""'

The above message is shown whenever program (extending
or embedding python with C/C++) using Python.h was
compilled.

OS: Fedora Core 2
compiller: GCC 3.4.0
libc: glibc-2.3
Python: 2.3.3
msg22667 - (view) Author: Martin v. Löwis (loewis) Date: 2004-10-19 19:39
Logged In: YES 
user_id=21627

This is a bug in your program. See

http://docs.python.org/api/includes.html
msg22668 - (view) Author: Eugene Sizikov (eugene_beast) Date: 2004-10-20 00:00
Logged In: YES 
user_id=126917

But why not made it more compliant in Python.h :

#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE
#endif

???
msg22669 - (view) Author: Martin v. Löwis (loewis) Date: 2004-10-20 06:26
Logged In: YES 
user_id=21627

Python itself and Python extensions must be compiled with
precisely the same settings, so taking some other setting of
_POSIX_C_SOURCE may cause binary incompatibility.

If you include Python.h first, as you should,
_POSIX_C_SOURCE will not be defined, so the #ifndef should
not have any effect except in broken extension modules.
History
Date User Action Args
2004-10-13 05:06:02eugene_beastcreate