From patchwork Tue Jul 3 15:57:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 28213 Received: (qmail 77060 invoked by alias); 3 Jul 2018 15:58:18 -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 77047 invoked by uid 89); 3 Jul 2018 15:58:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=2009, U*simon.marchi, carrying, sk:simonm X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Jul 2018 15:58:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1530633492; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=l4oHTGvaw+X7fn02gX3YWodO0OlW56p/c5GZ1QI719w=; b=EQEmHed1a+DINB2IoqVf1AptpTOwHolpIdXYmH6KLEe8iudTU4k6lzsUxbXmWB6e HWrU3P019Md9k54yJZr0ur7/FQB3FXmlYVfVG72ulWKN1uw22FQNF5OfHtw0KUc7 XVMor6I5I8X3+7Tzl2F2JfQL4S8X8dYkO/kTp8PjffU=; Received: from ESESSMB502.ericsson.se (Unknown_Domain [153.88.183.120]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id F6.B2.25360.41D9B3B5; Tue, 3 Jul 2018 17:58:12 +0200 (CEST) Received: from ESESSMR503.ericsson.se (153.88.183.112) by ESESSMB502.ericsson.se (153.88.183.190) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 3 Jul 2018 17:58:11 +0200 Received: from ESESSMB504.ericsson.se (153.88.183.165) by ESESSMR503.ericsson.se (153.88.183.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 3 Jul 2018 17:58:11 +0200 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB504.ericsson.se (153.88.183.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Tue, 3 Jul 2018 17:58:11 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jZ6Ms27Z4ZtSnI9vl7fFCzYjnbFe2Oiza1kpLxQwxc0=; b=DzCKGy3vOs8D/rm/xlGivS85Tn/IVlKfQu4FpJx1MtwQ6pXrMR1Mo4itfp+nzwHpzq3yXKPWQmwWDlPrjt5jrK9L+F16FhSyE27W84NU7x87pvona+xYugJnl62pPkoEM4qOROU6OIwBMPbnpM+xNJz/LT3MM2CSrrf6asheajo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [142.133.60.250] (192.75.88.130) by BYAPR15MB2392.namprd15.prod.outlook.com (2603:10b6:a02:8d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Tue, 3 Jul 2018 15:58:08 +0000 Subject: Re: [RFA] Make macOS build warning-free To: Tom Tromey , Simon Marchi CC: References: <20180629165453.22888-1-tom@tromey.com> <87woudofal.fsf@tromey.com> <5f9b4ce1-aa8d-30e3-98f9-f2c36c3869c6@simark.ca> <87k1qco3vk.fsf@tromey.com> From: Simon Marchi Message-ID: <06af645c-3385-7f78-5aa8-d48566c66a45@ericsson.com> Date: Tue, 3 Jul 2018 11:57:55 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <87k1qco3vk.fsf@tromey.com> Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes On 2018-07-03 09:17 AM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> _INTL_MAY_RETURN_STRING_ARG thing is a gcc/binutils/gdb addition, on top of the > Simon> v0.12.1 version of gettext. So we shouldn't have to deal with upstream gettext > Simon> to fix this, since it's just the gcc/binutils/gdb addition that needs to be fixed. > > It's upstream as well though. Maybe it was upstreamed from gcc to > gettext? I don't really know the history there. > > I'll send a note to the gettext list. Ah ok I see, it is present in later versions of gettext. I will follow the discussion on the gettext mailing to see where it goes. Grepping and git-blaming the clang source code, it looks like clang has supported the attribute since at least 2009, and clang has been the default compiler on Mac since about that time too. So it should be safe to just remove the __APPLE_CC__ #if completely. If this is fixed upstream, I think we could just mirror the change in our local copy of libgnuintl.h, without importing a whole new version of gettext (which would probably be a lot of work). > Simon> That bit looks good to me, at least to shut up the compiler. But I'm wondering > Simon> if we still need that section_offsets structure, or if we could just replace > Simon> it with std::vector/gdb:array_view. > > I think it's a good idea to rewrite section_offsets, but that seems more involved. > Also the way that this code is using std::vector and then turning it > into a section_offsets* seems incorrect. Indeed. I started a prototype, it uncovered an issue about reread_symbol accessing objfile::section_offsets out of bounds, so I'm stuck on that. > I think the symfile.c change isn't enough, btw; the > -Wno-deprecated-declarations bit is also required. Otherwise there is at > least one error (about the use of syscall). But maybe I could disable that > one with a #pragma instead - what do you think? About this part, I would prefer if we disabled the warning at the call sites instead of disabling the warning across the board, since the warning could be relevant sometimes. Or maybe we should look at using a non-deprecated alternative... Here's the other patch I've been carrying. If you think it's good, I can finish it and push it, or you can steal it. From e458931de993f87702384591701b21edf8299279 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sun, 25 Jun 2017 15:17:43 -0400 Subject: [PATCH 2/2] Ignore deprecation of sbrk and syscall --- gdb/darwin-nat.c | 3 +++ gdb/main.c | 3 +++ gdb/maint.c | 6 ++++++ include/diagnostics.h | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 7dccce7392..b46d8b5632 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -836,7 +836,10 @@ darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread, { /* Note: ptrace is allowed only if the process is stopped. Directly send the signal to the thread. */ + DIAGNOSTIC_PUSH + DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS res = syscall (SYS___pthread_kill, thread->gdb_port, nsignal); + DIAGNOSTIC_POP inferior_debug (4, _("darwin_resume_thread: kill 0x%x %d: %d\n"), thread->gdb_port, nsignal, res); thread->signaled = 1; diff --git a/gdb/main.c b/gdb/main.c index 9694af2426..0c597685f5 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -488,8 +488,11 @@ captured_main_1 (struct captured_main_args *context) struct objfile *objfile; #ifdef HAVE_SBRK +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS /* Set this before constructing scoped_command_stats. */ lim_at_start = (char *) sbrk (0); +DIAGNOSTIC_POP #endif scoped_command_stats stat_reporter (false); diff --git a/gdb/maint.c b/gdb/maint.c index a8a1fcbc29..0b3a3e04e6 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -829,7 +829,10 @@ scoped_command_stats::~scoped_command_stats () if (m_space_enabled && per_command_space) { #ifdef HAVE_SBRK +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS char *lim = (char *) sbrk (0); +DIAGNOSTIC_POP long space_now = lim - lim_at_start; long space_diff = space_now - m_start_space; @@ -867,7 +870,10 @@ scoped_command_stats::scoped_command_stats (bool msg_type) if (!m_msg_type || per_command_space) { #ifdef HAVE_SBRK +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS char *lim = (char *) sbrk (0); +DIAGNOSTIC_POP m_start_space = lim - lim_at_start; m_space_enabled = 1; #endif diff --git a/include/diagnostics.h b/include/diagnostics.h index 4a674106dc..ecf77969f9 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -35,6 +35,8 @@ #if defined (__clang__) /* clang */ # define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move") +# define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \ + DIAGNOSTIC_IGNORE ("-Wdeprecated-declarations") # define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \ DIAGNOSTIC_IGNORE ("-Wdeprecated-register") # define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \ @@ -72,4 +74,8 @@ # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION #endif +#ifndef DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS +# define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS +#endif + #endif /* DIAGNOSTICS_H */