Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Dave Murphy <davem@devkitpro.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] fix compile error with clang
Date: Thu, 20 Dec 2018 17:26:00 -0000	[thread overview]
Message-ID: <CAAjerb+FtaH_qG3qKj4La+u+Mv-atCM2y0zFmZD_LJ1a5zsLOA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

Cross compiling for macOS using osxcross gives errors of the form
"error: default initialization of an object of ... without a
user-provided default constructor"

Fixed by attached patch, tested compile with mingw-w64, osxcross and
linux native builds.

2018-12-20  Dave Murphy  <davem@devkitpro.org>

    * gdb/dtrace-probe.c (dtrace_static_probe_ops): explicit zero initialise.
    * gdb/probe.c (any_static_probe_ops): ditto
    * gdb/record-btrace.c (record_btrace_thread_observer_token): ditto
    * gdb/stap-probe.c (stap_static_probe_ops): ditto
    * gdb/tui/tui-hooks.c (tui_observers_token): ditto
    * gdb/unittests/observable-selftests.c (token1, token2, token3): ditto

[-- Attachment #2: clang-fixes.patch --]
[-- Type: application/octet-stream, Size: 2834 bytes --]

diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index fa4e06e794..b6afc4cc7c 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 1f3da213ef..4acbeb8704 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 1ca0176ec8..a836cfff55 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 ed7e1a0d3f..42fad3835f 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 efa02e2f08..1c341dcf47 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 6f2f7e8bcc..1b67770de6 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);

             reply	other threads:[~2018-12-20 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20 17:26 Dave Murphy [this message]
2018-12-20 19:25 ` Simon Marchi
2018-12-20 21:39   ` Dave Murphy
2018-12-21 17:00     ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAjerb+FtaH_qG3qKj4La+u+Mv-atCM2y0zFmZD_LJ1a5zsLOA@mail.gmail.com \
    --to=davem@devkitpro.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox