From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Roman Kiryanov" <rkir@google.com>, "Felix Wu" <flwu@google.com>,
qemu-devel <qemu-devel@nongnu.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH 1/1] include/qemu: Provide a C++ compatible version of typeof_strip_qual
Date: Tue, 25 Jun 2024 11:31:46 +0100 [thread overview]
Message-ID: <ZnqckibHOALRQWBj@redhat.com> (raw)
In-Reply-To: <CAFEAcA8pQ_XtitN-Zy63xxGT=6mBEuha7PCeJc-=OJWcvuw=vg@mail.gmail.com>
On Tue, Jun 25, 2024 at 11:16:16AM +0100, Peter Maydell wrote:
> On Tue, 25 Jun 2024 at 10:27, Peter Maydell <peter.maydell@linaro.org> wrote:
> >
> > On Tue, 25 Jun 2024 at 07:19, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> > >
> > > On 25/6/24 08:05, Paolo Bonzini wrote:
> > > >
> > > >
> > > > Il mar 25 giu 2024, 04:32 Roman Kiryanov <rkir@google.com
> > > > <mailto:rkir@google.com>> ha scritto:
> > > >
> > > > Hi Philippe, thank you for looking.
> > > >
> > > > On Mon, Jun 24, 2024 at 7:27 PM Philippe Mathieu-Daudé
> > > > <philmd@linaro.org <mailto:philmd@linaro.org>> wrote:
> > > > > In particular this patch seems contained well enough
> > > > > to be carried in forks were C++ _is_ used.
> > > >
> > > > Will you agree to take #ifdef __cplusplus and #error to the QEMU side
> > > > in atomic.h and
> > > > we will keep atomic.hpp on our side? The error message looks better
> > > > when atomic.hpp
> > > > is somewhere near.
> > > >
> > > >
> > > > I think we should also move typeof_strip_qual elsewhere; I will take a
> > > > look. I think there are a couple headers that already have #ifdef
> > > > __cplusplus, but I need to check (no source code around right now).
> > >
> > > $ git grep -l __cplusplus
> > > ebpf/rss.bpf.skeleton.h
> > > include/hw/xtensa/xtensa-isa.h
> > > include/qemu/compiler.h
> > > include/qemu/osdep.h
> > > include/standard-headers/drm/drm_fourcc.h
> > > include/sysemu/os-posix.h
> > > include/sysemu/os-win32.h
> > > linux-headers/linux/stddef.h
> > > qga/vss-win32/requester.h
> >
> > We should delete all of those, they're dead code for us now.
> > We dropped some of the extern-C-block handling in
> > commit d76aa73fad1f6 but that didn't get all of them.
>
> I was wrong about this -- I had forgotten about the Windows
> Guest Agent code that has to be built with the Windows C++
> compiler -- some of the cpp files in qga/vss-win32/ include
> osdep.h. So the files above break down into:
>
> * files imported from third-party projects, or generated
> by third-party tools:
> + ebpf/rss.bpf.skeleton.h
> + include/hw/xtensa/xtensa-isa.h
> + include/standard-headers/drm/drm_fourcc.h
> + linux-headers/linux/stddef.h
>
> * QEMU include files that we need to include directly
> or indirectly from the vss-win32 files:
> + include/qemu/compiler.h
> + include/qemu/osdep.h
> + include/sysemu/os-win32.h
> + include/sysemu/os-posix.h
> + qga/vss-win32/requester.h
>
> Maybe we could drop the cplusplus handling from os-posix.h,
> but I guess we're keeping it in parallel with os-win32.h.
The vss-win32 code is specialized & self-contained code. Since
it is inherantly Windows only code, it does not need any platform
portability support which is what osdep.h would ordinarily assist
with.
As an example, if you remove osdep.h from the vss-win32 code,
the following changes appear sufficient to solve the resulting
compile issues.
This could let us remove remaining cplusplus usage from the
common QEMU headers:
diff --git a/qga/vss-win32/provider.cpp b/qga/vss-win32/provider.cpp
index cc72e5ef1b..ed2d8097ee 100644
--- a/qga/vss-win32/provider.cpp
+++ b/qga/vss-win32/provider.cpp
@@ -10,7 +10,6 @@
* See the COPYING file in the top-level directory.
*/
-#include "qemu/osdep.h"
#include "vss-common.h"
#include "vss-debug.h"
#ifdef HAVE_VSS_SDK
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 9884c65e70..e519e6cfd7 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -10,7 +10,6 @@
* See the COPYING file in the top-level directory.
*/
-#include "qemu/osdep.h"
#include "vss-common.h"
#include "vss-debug.h"
#include "requester.h"
diff --git a/qga/vss-win32/vss-common.h b/qga/vss-win32/vss-common.h
index 0e67e7822c..5c6b21ce21 100644
--- a/qga/vss-win32/vss-common.h
+++ b/qga/vss-win32/vss-common.h
@@ -16,6 +16,9 @@
#define __MIDL_user_allocate_free_DEFINED__
#include <windows.h>
#include <shlwapi.h>
+#include <glib.h>
+#include <assert.h>
+#include "config-host.h"
/* Reduce warnings to include vss.h */
diff --git a/qga/vss-win32/vss-debug.cpp b/qga/vss-win32/vss-debug.cpp
index 820b1c6667..ec4c2b3093 100644
--- a/qga/vss-win32/vss-debug.cpp
+++ b/qga/vss-win32/vss-debug.cpp
@@ -10,7 +10,6 @@
* See the COPYING file in the top-level directory.
*/
-#include "qemu/osdep.h"
#include "vss-debug.h"
#include "vss-common.h"
diff --git a/qga/vss-win32/vss-debug.h b/qga/vss-win32/vss-debug.h
index 7800457392..77fd669698 100644
--- a/qga/vss-win32/vss-debug.h
+++ b/qga/vss-win32/vss-debug.h
@@ -10,8 +10,9 @@
* See the COPYING file in the top-level directory.
*/
-#include "qemu/osdep.h"
#include <vss-handles.h>
+#include <glib.h>
+#include <stdio.h>
#ifndef VSS_DEBUG_H
#define VSS_DEBUG_H
With 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:[~2024-06-25 10:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 20:56 [PATCH 1/1] include/qemu: Provide a C++ compatible version of typeof_strip_qual Felix Wu
2024-06-25 2:26 ` Philippe Mathieu-Daudé
2024-06-25 2:32 ` Roman Kiryanov
2024-06-25 6:05 ` Paolo Bonzini
2024-06-25 6:19 ` Philippe Mathieu-Daudé
2024-06-25 9:27 ` Peter Maydell
2024-06-25 10:16 ` Peter Maydell
2024-06-25 10:31 ` Daniel P. Berrangé [this message]
2024-06-25 6:07 ` Thomas Huth
2024-06-25 7:52 ` 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=ZnqckibHOALRQWBj@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=flwu@google.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rkir@google.com \
--cc=thuth@redhat.com \
/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 NNTP newsgroup(s).