public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Fix ODR warning in observable.h
Date: Thu,  2 Jun 2022 15:28:53 +0000 (GMT)	[thread overview]
Message-ID: <20220602152853.826BB3857BAD@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=57ebc9901305133000100fa7764dac94b4208a3b

commit 57ebc9901305133000100fa7764dac94b4208a3b
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue May 10 08:47:34 2022 -0600

    Fix ODR warning in observable.h
    
    observable.h triggers an ODR warning because this line:
    
        extern observable<struct target_ops */* target */> target_changed;
    
    ... may be the only declaration of "struct target_ops" in scope
    (depending on the particular .c file) -- and this declares it in a
    namespace, resulting in confusion.
    
    This patch fixes the problem by adding a forward declaration.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395

Diff:
---
 gdb/observable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/observable.h b/gdb/observable.h
index f426c1a761f..796bf2a43c6 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -28,6 +28,7 @@ struct objfile;
 struct thread_info;
 struct inferior;
 struct process_stratum_target;
+struct target_ops;
 struct trace_state_variable;
 
 namespace gdb


                 reply	other threads:[~2022-06-02 15:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220602152853.826BB3857BAD@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).