From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Christian Ehrhardt <christian.ehrhardt@canonical.com>
Subject: Re: [PATCH] disas: Fix build with glib2.0 >=2.67.3
Date: Wed, 24 Feb 2021 13:15:26 +0000 [thread overview]
Message-ID: <YDZRbkiRzDgtKvXu@redhat.com> (raw)
In-Reply-To: <CAFEAcA8DvXVxRvB0ZtQh3j5Y=34DOC1CzUY1LkuMB5WCJKthmg@mail.gmail.com>
On Wed, Feb 24, 2021 at 01:07:33PM +0000, Peter Maydell wrote:
> On Wed, 24 Feb 2021 at 11:04, Daniel P. Berrangé <berrange@redhat.com> wrote:
> > So from osdep.h I think something like this is likely sufficient:
> >
> > diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> > index ba15be9c56..7a1d83a8b6 100644
> > --- a/include/qemu/osdep.h
> > +++ b/include/qemu/osdep.h
> > @@ -126,6 +126,7 @@ extern int daemon(int, int);
> > #include "glib-compat.h"
> > #include "qemu/typedefs.h"
> >
> > +extern "C" {
>
> Needs to be protected by #ifdef so it's only relevant for the
> C++ compiler, right?
>
> > /*
> > * For mingw, as of v6.0.0, the function implementing the assert macro is
> > * not marked as noreturn, so the compiler cannot delete code following an
> > @@ -722,4 +723,6 @@ static inline int platform_does_not_support_system(const char *command)
> > }
> > #endif /* !HAVE_SYSTEM_FUNCTION */
> >
> > +}
> > +
> > #endif
> >
> >
> > We'll also need to them protect any local headers we use before this point.
> >
> > $ grep #include ../../../include/qemu/osdep.h | grep -v '<'
> > #include "config-host.h"
> > #include CONFIG_TARGET
> > #include "exec/poison.h"
> > #include "qemu/compiler.h"
> > #include "sysemu/os-win32.h"
> > #include "sysemu/os-posix.h"
> > #include "glib-compat.h"
> > #include "qemu/typedefs.h"
> >
> > and transitively through that list, but I think there's no too many
> > more there.
>
> Is there anything we can do to make the compiler complain if we
> get this wrong? Otherwise it seems likely that we'll end up
> accidentally putting things inside or outside 'extern "C"'
> declarations when they shouldn't be, as we make future changes
> to our headers.
There's nothing easy I know of to highlight this. It is more the kind
of thing checkpatch would have to look at - complain if there is
anything which isn't a preprocessor include directive or comment
before the 'extern'.
> (The other approach would be to try to get rid of the
> C++ in the codebase. We could probably say 'drop vixl
> and always use capstone', for instance.)
Yeah, getting rid of C++ would probably be the sanest solution long
term.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-02-24 13:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 14:56 [PATCH] disas: Fix build with glib2.0 >=2.67.3 Christian Ehrhardt
2021-02-23 15:43 ` Peter Maydell
2021-02-23 16:07 ` Daniel P. Berrangé
2021-02-24 7:38 ` Christian Ehrhardt
2021-02-24 11:04 ` Daniel P. Berrangé
2021-02-24 13:07 ` Peter Maydell
2021-02-24 13:15 ` Daniel P. Berrangé [this message]
2021-03-08 13:50 ` Christian Ehrhardt
2021-03-08 13:55 ` Daniel P. Berrangé
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=YDZRbkiRzDgtKvXu@redhat.com \
--to=berrange@redhat.com \
--cc=christian.ehrhardt@canonical.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.