From patchwork Fri Dec 21 16:59:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 30793 Received: (qmail 81807 invoked by alias); 21 Dec 2018 17:00:46 -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 81247 invoked by uid 89); 21 Dec 2018 17:00:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, MIME_BASE64_BLANKS autolearn=ham version=3.3.2 spammy=HX-Brightmail-Tracker:sk:H4sIAAA, targeting, H*RU:sk:sessmg2, UD:ericsson.com X-HELO: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Dec 2018 17:00:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1545411600; x=1548003600; 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=MEfDgRsf/croVspyb5fBOlgSmGXhshCY8pbHRwZ50RU=; b=KXIuVVOsPCy3XNZetMdq4EmrVe3bCQBVcXP/govJLyOeA03FiMwPD0T1N1OcC+cu Cx6QkphKLw5vTzE32yYpNMIBpkbBF0twXLEYL5CCCi+Oe6IkBNbDMdi0/+MRhzio 3tIhC4RTxN2TtN+c85tAfC34mngIK+VI65I1YQqW4HA=; Received: from ESESSMB501.ericsson.se (Unknown_Domain [153.88.183.119]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 25.3D.01583.01C1D1C5; Fri, 21 Dec 2018 18:00:00 +0100 (CET) Received: from ESESSMB504.ericsson.se (153.88.183.165) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 21 Dec 2018 18:00:00 +0100 Received: from NAM04-BN3-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; Fri, 21 Dec 2018 17:59:59 +0100 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=MEfDgRsf/croVspyb5fBOlgSmGXhshCY8pbHRwZ50RU=; b=lSYPJqsQpTmxDp04fifzn4ZdkOS5ONZcdpI/0gfEIvASFdgjAqOTf9kaOllRX+e7aCvjLNaOeVbiNANLsZ7RnGDGRQulIuFh5MomgoyUtdgFcmsjQltqIm+dAHII9HaYk9TglQi0ock3U+Bjegpco3kDgPK0G+1RuRGugpI3Uew= Received: from BYAPR15MB2390.namprd15.prod.outlook.com (52.135.198.30) by BYAPR15MB2245.namprd15.prod.outlook.com (52.135.196.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Fri, 21 Dec 2018 16:59:48 +0000 Received: from BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::a143:f30c:dd42:3af9]) by BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::a143:f30c:dd42:3af9%4]) with mapi id 15.20.1425.025; Fri, 21 Dec 2018 16:59:48 +0000 From: Simon Marchi To: Dave Murphy , Simon Marchi CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] fix compile error with clang Date: Fri, 21 Dec 2018 16:59:48 +0000 Message-ID: <7ec112b7-d8b5-cf59-3596-06455531f2c2@ericsson.com> References: In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) Content-ID: MIME-Version: 1.0 Return-Path: simon.marchi@ericsson.com X-IsSubscribed: yes On 2018-12-20 4:38 p.m., Dave Murphy wrote: > Hi Simon, > > The error I get is > > ../../binutils-gdb/gdb/unittests/observable-selftests.c:73:31: error: > default initialization of an object of const type 'const > gdb::observers::token' without a user-provided default constructor > const gdb::observers::token token1, token2, token3; > ^ > {} > clang version is > > davem@devkit-builder:~$ /opt/osx/bin/x86_64-apple-darwin15-clang --version > > clang version 3.8.1-24 (tags/RELEASE_381/final) > Target: x86_64-apple-darwin15 > Thread model: posix > > (targeting 10.9+ host) > > build machine is debian stretch > > davem@devkit-builder:~$ uname -a > Linux devkit-builder 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 > (2018-10-27) x86_64 GNU/Linux Thanks for the details, I was able to reproduce using clang 3.8 on Debian stable. I think it's worth fixing since it doesn't hurt when building other compilers, and clang 3.8 is still the default clang version on the current Debian stable. Here's what I pushed: From 3dcfdc58656caa4a38e1fde73a07a19114347226 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Fri, 21 Dec 2018 11:14:28 -0500 Subject: [PATCH] Fix compile error with clang 3.8 When compiling with clang 3.8 (default clang version on Debian Stretch, the current stable), we get errors like this: CXX dtrace-probe.o ../../binutils-gdb/gdb/dtrace-probe.c:103:31: error: default initialization of an object of const type 'const dtrace_static_probe_ops' without a user-provided default constructor const dtrace_static_probe_ops dtrace_static_probe_ops; ^ Silence them by value-initializing those objects. It's not necessary with other compilers (later clang versions, gcc), but it shouldn't hurt either. --- gdb/ChangeLog | 10 ++++++++++ gdb/dtrace-probe.c | 2 +- gdb/probe.c | 2 +- gdb/record-btrace.c | 2 +- gdb/stap-probe.c | 2 +- gdb/tui/tui-hooks.c | 2 +- gdb/unittests/observable-selftests.c | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 28ab3345032..953bc17be1f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2018-12-21 Dave Murphy + + * dtrace-probe.c (dtrace_static_probe_ops): Explicit zero + initialise. + * probe.c (any_static_probe_ops): Ditto. + * record-btrace.c (record_btrace_thread_observer_token): Ditto. + * stap-probe.c (stap_static_probe_ops): Ditto. + * tui/tui-hooks.c (tui_observers_token): Ditto. + * unittests/observable-selftests.c (token1, token2, token3): Ditto. + 2018-12-19 Andrew Burgess * gdb/dummy-frame.c (default_dummy_id): Defined new function. diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index fa4e06e7947..0c75904c585 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -100,7 +100,7 @@ public: /* DTrace static_probe_ops. */ -const dtrace_static_probe_ops dtrace_static_probe_ops; +const dtrace_static_probe_ops dtrace_static_probe_ops {}; /* The following structure represents a dtrace probe. */ diff --git a/gdb/probe.c b/gdb/probe.c index 1f3da213efc..5702afe0d2f 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -60,7 +60,7 @@ public: /* Static operations associated with a generic probe. */ -const any_static_probe_ops any_static_probe_ops; +const any_static_probe_ops any_static_probe_ops {}; /* A helper for parse_probes that decodes a probe specification in SEARCH_PSPACE. It appends matching SALs to RESULT. */ diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 1ca0176ec81..92c0821ec92 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -143,7 +143,7 @@ static record_btrace_target record_btrace_ops; /* Token associated with a new-thread observer enabling branch tracing for the new thread. */ -static const gdb::observers::token record_btrace_thread_observer_token; +static const gdb::observers::token record_btrace_thread_observer_token {}; /* Memory access types used in set/show record btrace replay-memory-access. */ static const char replay_memory_access_read_only[] = "read-only"; diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index ed7e1a0d3fb..b79cb153a93 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -119,7 +119,7 @@ public: /* SystemTap static_probe_ops. */ -const stap_static_probe_ops stap_static_probe_ops; +const stap_static_probe_ops stap_static_probe_ops {}; class stap_probe : public probe { diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index efa02e2f08a..3a9bff30a6a 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -205,7 +205,7 @@ tui_normal_stop (struct bpstats *bs, int print_frame) /* Token associated with observers registered while TUI hooks are installed. */ -static const gdb::observers::token tui_observers_token; +static const gdb::observers::token tui_observers_token {}; /* Attach or detach a single observer, according to ATTACH. */ diff --git a/gdb/unittests/observable-selftests.c b/gdb/unittests/observable-selftests.c index 6f2f7e8bccf..903baa741c5 100644 --- a/gdb/unittests/observable-selftests.c +++ b/gdb/unittests/observable-selftests.c @@ -70,7 +70,7 @@ run_tests () attached. */ notify_check_counters (0, 0, 0); - const gdb::observers::token token1, token2, token3; + const gdb::observers::token token1 {}, token2 {} , token3 {}; /* Now, attach one observer, and send a notification. */ test_notification.attach (&test_second_notification_function, token2);