Add constructor to stap_static_probe_ops

Message ID 20191219184029.13172-1-tromey@adacore.com
State New
Headers show
Series
  • Add constructor to stap_static_probe_ops
Related show

Commit Message

Tom Tromey Dec. 19, 2019, 6:40 p.m.
PR build/24937 concerns an error given by the clang provided by a
particular version of macOS.  In particular, it reports

    error: default initialization of an object of const type 'const
    stap_static_probe_ops' without a user-provided default constructor

Although (at least according to sources I found online) this was
resolved as a bug in the standard, it seemed simple enough to work
around this.

Given that this is a trivial build fix, I think it should go on the
gdb 9 branch as well.

gdb/ChangeLog
2019-12-19  Tom Tromey  <tromey@adacore.com>

	PR build/24937:
	* stap-probe.c (class stap_static_probe_ops): Add constructor.

Change-Id: I18f180c17850f420e9b66afc67f9cb3d8dceb0b3
---
 gdb/ChangeLog    | 5 +++++
 gdb/stap-probe.c | 6 ++++++
 2 files changed, 11 insertions(+)

-- 
2.21.0

Comments

Tom Tromey Jan. 7, 2020, 4:44 p.m. | #1
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:


Tom> PR build/24937 concerns an error given by the clang provided by a
Tom> particular version of macOS.  In particular, it reports

Tom>     error: default initialization of an object of const type 'const
Tom>     stap_static_probe_ops' without a user-provided default constructor

Tom> Although (at least according to sources I found online) this was
Tom> resolved as a bug in the standard, it seemed simple enough to work
Tom> around this.

Tom> Given that this is a trivial build fix, I think it should go on the
Tom> gdb 9 branch as well.

Tom> gdb/ChangeLog
Tom> 2019-12-19  Tom Tromey  <tromey@adacore.com>

Tom> 	PR build/24937:
Tom> 	* stap-probe.c (class stap_static_probe_ops): Add constructor.

I'm checking this in now.

Tom

Patch

diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index ba927790a5d..e162a3bbe1b 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -101,6 +101,12 @@  struct stap_probe_arg
 class stap_static_probe_ops : public static_probe_ops
 {
 public:
+  /* We need a user-provided constructor to placate some compilers.
+     See PR build/24937.  */
+  stap_static_probe_ops ()
+  {
+  }
+
   /* See probe.h.  */
   bool is_linespec (const char **linespecp) const override;