From patchwork Sun Sep 16 18:45:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 29410 Received: (qmail 128632 invoked by alias); 16 Sep 2018 18:46:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 128264 invoked by uid 89); 16 Sep 2018 18:45:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_RP_RNBL, SPF_HELO_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=differently, 9657 X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.50.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Sep 2018 18:45:05 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 45AB312060 for ; Sun, 16 Sep 2018 13:45:04 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 1c2ag18ViPvAd1c2agv4DG; Sun, 16 Sep 2018 13:45:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uHsp9ZnvIz+eMttN7rUU6A4UVBZxca2WADo7lZeE6Kk=; b=kQ5KiUez+Wy7kvn/fTZpVtws4f EsGhladZ3paIb5lGUxhQiE0RkemIdicPRlJKCE2B2p3bj8ZbsrVuuFWSbSo8vt2JaCrx1tFtSHV9P WolyOawkRGCDy2XeBQkgFYE8B; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:45184 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1g1c2a-000oVx-20; Sun, 16 Sep 2018 13:45:04 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/2] Do not pass -DNDEBUG to Python compilations in development mode Date: Sun, 16 Sep 2018 12:45:02 -0600 Message-Id: <20180916184502.19617-3-tom@tromey.com> In-Reply-To: <20180916184502.19617-1-tom@tromey.com> References: <20180916184502.19617-1-tom@tromey.com> The Python CFLAGS include -DNDEBUG. This was apparently done intentionally -- setting the flags is done manually because, according to a comment, python-config passes too many things to the compiler (which is true). Per PR python/20445, this patch changes configure so that -DNDEBUG is only used by release builds. This probably doesn't have very much effect in practice, but I did see that some Python headers use assert, so perhaps it will give some safety. Tested by rebuilding and re-running gdb.python/*.exp on x86-64 Fedora 28. ChangeLog 2018-09-16 Tom Tromey PR python/20445: * configure: Rebuild. * configure.ac: Conditionally use -DNDEBUG for Python. --- gdb/ChangeLog | 6 ++++++ gdb/configure | 6 +++++- gdb/configure.ac | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gdb/configure b/gdb/configure index e011b77414b..2fb69a8eda6 100755 --- a/gdb/configure +++ b/gdb/configure @@ -10762,7 +10762,11 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h # would make the python-related objects be compiled differently from the # rest of GDB (e.g., -O2 and -fPIC). if test "${GCC}" = yes; then - tentative_python_cflags="-fno-strict-aliasing -DNDEBUG -fwrapv" + tentative_python_cflags="-fno-strict-aliasing -fwrapv" + # Python headers recommend -DNDEBUG, but it's unclear if that just + # refers to building Python itself. In release mode, though, it + # doesn't hurt for the Python code in gdb to follow. + $development || tentative_python_cflags="tentative_python_cflags -DNDEBUG" fi if test "x${tentative_python_cflags}" != x; then diff --git a/gdb/configure.ac b/gdb/configure.ac index f658da84e32..0709b1ff720 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -965,7 +965,11 @@ if test "${have_libpython}" != no; then # would make the python-related objects be compiled differently from the # rest of GDB (e.g., -O2 and -fPIC). if test "${GCC}" = yes; then - tentative_python_cflags="-fno-strict-aliasing -DNDEBUG -fwrapv" + tentative_python_cflags="-fno-strict-aliasing -fwrapv" + # Python headers recommend -DNDEBUG, but it's unclear if that just + # refers to building Python itself. In release mode, though, it + # doesn't hurt for the Python code in gdb to follow. + $development || tentative_python_cflags="tentative_python_cflags -DNDEBUG" fi if test "x${tentative_python_cflags}" != x; then