Fix compile error with clang 3.8
authorDave Murphy <davem@devkitpro.org>
Fri, 21 Dec 2018 16:14:28 +0000 (11:14 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 21 Dec 2018 16:45:16 +0000 (11:45 -0500)
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
gdb/dtrace-probe.c
gdb/probe.c
gdb/record-btrace.c
gdb/stap-probe.c
gdb/tui/tui-hooks.c
gdb/unittests/observable-selftests.c

index 28ab3345032df67cb3539ea7c180000c219ad644..953bc17be1fcff820cfdd243f7ae3e94a074a770 100644 (file)
@@ -1,3 +1,13 @@
+2018-12-21  Dave Murphy  <davem@devkitpro.org>
+
+       * 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  <andrew.burgess@embecosm.com>
 
        * gdb/dummy-frame.c (default_dummy_id): Defined new function.
index fa4e06e794719a1c20030bdc7b7d365fa5b2794b..0c75904c585bad30c7fc2384fd40b1f18a4a377f 100644 (file)
@@ -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.  */
 
index 1f3da213efc9fa5493ae9c0c6b030298600539be..5702afe0d2f4fb84f194f57d319ae602a31d8cfe 100644 (file)
@@ -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.  */
index 1ca0176ec81a3354c0165e4249e16b8ed1c10859..92c0821ec924332f370f346066759b0555e76294 100644 (file)
@@ -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";
index ed7e1a0d3fb89ac4300106ecf735080107e3c1bb..b79cb153a937c9d0959116067b666e06889740fd 100644 (file)
@@ -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
 {
index efa02e2f08a0a2ef7971ab328271fbb1fb9692c7..3a9bff30a6a7bd41e84642eb06943fe45cfd004f 100644 (file)
@@ -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.  */
 
index 6f2f7e8bccf7890e334c38da6d471ae7c51d9c80..903baa741c5546724de188fea32aebf8324f8cb7 100644 (file)
@@ -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);