From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90435 invoked by alias); 11 Aug 2016 01:56:01 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 90275 invoked by uid 89); 11 Aug 2016 01:55:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=bracket, stdinth, stdint.h, UD:stdint.h X-HELO: mail-oi0-f41.google.com Received: from mail-oi0-f41.google.com (HELO mail-oi0-f41.google.com) (209.85.218.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 11 Aug 2016 01:55:56 +0000 Received: by mail-oi0-f41.google.com with SMTP id c15so83527123oig.0 for ; Wed, 10 Aug 2016 18:55:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Eflw9yeUggLAahk3IT4kRbgz91sRJEK5X+ChUzGr66I=; b=DsptuoI6pYuExHn9+svCHugyLsaSRadS9jIAi0Uc81paLS25bpHcUzPizt1evQCDyG aqJ+4RDs0jSH3xh6roDSn8vNcc0RNKBtgj3XQzLPnPNLKn0EDEs0QcUWOKlrRPSNDJSW wYxofDPEwv4rKt1x5IodancmzO+T/qPTJ/zdLr4NtM2vlGNu3o5C6prrLCbR/LI7mye9 urCm0XaDq6sYMOdrgUKDlH/QEVbIoM2RcR2uHeFu5s9+LPexd0aWu3CSoQXEY/mxkXB+ HniJqEfIx+Ae8yKjE44hw07RAsIFvWZ7kimcnloTmN4noBcesrtqZYt53yRyxLD4+vZR hmPg== X-Gm-Message-State: AEkoous8k4cavMjDFX/8yGn1d6UZAbFci3cR6pHzfTsFA6HMjkcW3rA7Q8PIX0kIDVkRluCUx9aLRdHHAvX0Cg== X-Received: by 10.157.40.241 with SMTP id s104mr464729ota.160.1470880554449; Wed, 10 Aug 2016 18:55:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.60.50 with HTTP; Wed, 10 Aug 2016 18:55:54 -0700 (PDT) From: David Edelsohn Date: Thu, 11 Aug 2016 01:56:00 -0000 Message-ID: Subject: GDB Python extension on AIX To: "gdb@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2016-08/txt/msg00013.txt.bz2 When Python is installed correctly on AIX and the GDB configuration process finds Python, some of the source files that implement the GDB Python extension fail to compile on AIX with the following error: In file included from /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/6.1.0/include/c++/math.h:36:0, from build-gnulib/import/math.h:27, from /opt/freeware/include/python2.7/pyport.h:325, from /opt/freeware/include/python2.7/Python.h:58, from /home/dje/src/binutils-gdb/gdb/python/python-internal.h:9 , from /home/dje/src/binutils-gdb/gdb/python/python.c:94: /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/6.1.0/include/c++/cmath:640:11: error: '::isnan' has not been declared using ::isnan; ^~~~~ Makefile:2593: recipe for target 'python.o' failed This is due to a Python extension header redefining feature test macros in the compiler namespace that interfere with AIX math.h and libstdc++ math.h behavior gdb/python/python-internal.h includes the following fragment: /* Python 2.4 doesn't include stdint.h soon enough to get {u,}intptr_t needed by pyport.h. */ /* /usr/include/features.h on linux systems will define _POSIX_C_SOURCE if it sees _GNU_SOURCE (which config.h will define). pyconfig.h defines _POSIX_C_SOURCE to a different value than /usr/include/features.h does causing compilation to fail. To work around this, undef _POSIX_C_SOURCE before we include Python.h. Same problem with _XOPEN_SOURCE. */ #undef _POSIX_C_SOURCE #undef _XOPEN_SOURCE Redefining and undefining feature test macros, such as _POSIX_C_SOURCE and _XOPEN_SOURCE are not very wise things to do, especially in the middle of a sequence of includes that already may have included other system header files with conditionals that were affected by the macros in their original state. If I comment out this unfortunate fragment, GDB is able to compile on AIX with the Python extension. Is this fragment necessary for other targets? Would the GDB community at least be open to a proposal to bracket this fragment with #ifndef _AIX ... #endif ? What is the preferred way to address this? Thanks, David