[Python-Dev] use of #pragma GCC system_header to suppress _XOPEN_SOURCE warnings

Skip Montanaro skip at pobox.com
Tue Aug 10 17:03:03 CEST 2004


    Martin> I don't think it is a goal that Python generates no warnings if
    Martin> compiled with a C++ compiler (I don't think you actually *can*
    Martin> compile all of Python with a C++ compiler).

Our goal is less ambitious than that.  It is to build locally written
extension modules and other stuff (both python-related and otherwise)
without warnings, not necessarily all software we build for internal use.

    >> This suggests that Sun expects the application or its build tools to
    >> define _XOPEN_SOURCE, not the compiler or its header files.  That
    >> suggests a bug in g++.

    Martin> Indeed, and I believe this is a known bug. g++ needs to define
    Martin> _XOPEN_SOURCE so that some of Sun's system headers declare a
    Martin> number of prototypes which are then referred-to in inline
    Martin> functions of libstdc++ header files; ...

    Martin> This gives us a number of options:
    Martin> 1. On Solaris, define _XOPEN_SOURCE to the same value that g++
    Martin>    uses.  This should then cause no redefinition, but might
    Martin>    cause some functions go away. We would need an autoconf test
    Martin>    to find out what the value of _XOPEN_SOURCE is that g++ uses.

Of the three this seemed most plausible to me.  A first pass at a
configure.in mod is available at

    http://python.org/sf/1006629

Assigned to Martin.

Skip


More information about the Python-Dev mailing list