Re: [PATCH 1/2] qom: Rename Object::class into Object::klass

2024-06-25 Thread Daniel P . Berrangé
On Tue, Jun 25, 2024 at 10:23:54AM +0100, Peter Maydell wrote:
> On Tue, 25 Jun 2024 at 03:20, Philippe Mathieu-Daudé  
> wrote:
> > Since you are posting different C++ enablement cleanups,
> > I suggest you add a section in our docs/devel/style.rst
> > requesting to keep headers C++ compatible, by not using
> > C++ reserved keywords, etc...
> >
> > In particular because the mainstream project is not build-testing
> > for C++, thus we will likely merge patches breaking C++ and
> > make your life harder. That said, a C++ header smoke-build job
> > in our CI could help.
> 
> Unless there's some easy mechanism for contributors to check
> that they haven't broken whatever our C++ requirement is,
> I don't think we should define it in the style guide.
> 
> More generally, we specifically removed the handling we
> had for being able to include our headers from C++ source
> files. (cf the stuff we added in commit 875df03b221 for
> extern "C" blocks and then removed again later). If we're
> not bringing that back (and I don't think we should) then
> we're not actually trying to have our headers be C++
> compatible, so what are we aiming for?

I really dislike the drip-feeding of patches fixing C++ related
problems. As maintainers we've no idea what the end state is,
is this the last patch, or are there another 100 of these patches
to trickle out one at a time. Ultimately from the QEMU maintainer
POV anything related to C++ compatibility is a distraction, given
the general consensus has turned to Rust as the future for QEMU,
not C++.

If we're going to take any C++ compat cleanups as a courtesy to
ease burden of a downstream fork, then I'd like to see a complete
series in one go, so we can sensibly evaluate whether the end
state is something desirable from QEMU's POV.

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 :|




Re: [PATCH 1/2] qom: Rename Object::class into Object::klass

2024-06-25 Thread Peter Maydell
On Tue, 25 Jun 2024 at 03:20, Philippe Mathieu-Daudé  wrote:
> Since you are posting different C++ enablement cleanups,
> I suggest you add a section in our docs/devel/style.rst
> requesting to keep headers C++ compatible, by not using
> C++ reserved keywords, etc...
>
> In particular because the mainstream project is not build-testing
> for C++, thus we will likely merge patches breaking C++ and
> make your life harder. That said, a C++ header smoke-build job
> in our CI could help.

Unless there's some easy mechanism for contributors to check
that they haven't broken whatever our C++ requirement is,
I don't think we should define it in the style guide.

More generally, we specifically removed the handling we
had for being able to include our headers from C++ source
files. (cf the stuff we added in commit 875df03b221 for
extern "C" blocks and then removed again later). If we're
not bringing that back (and I don't think we should) then
we're not actually trying to have our headers be C++
compatible, so what are we aiming for?

thanks
-- PMM



Re: [PATCH 1/2] qom: Rename Object::class into Object::klass

2024-06-25 Thread Daniel P . Berrangé
On Mon, Jun 24, 2024 at 08:43:59PM +, Felix Wu wrote:
> From: Roman Kiryanov 
> 
> 'class' is a C++ keyword and it prevents from
> using the QEMU headers with a C++ compiler.
> 
> Google-Bug-Id: 331190993
> Change-Id: I9ab7d2d77edef654a9c7b7cb9cd01795a6ed65a2

Please remove both of these lines when posting patches. They are
irrelevant to QEMU's git commit history.

> Signed-off-by: Felix Wu 
> Signed-off-by: Roman Kiryanov 
> ---
>  hw/core/qdev-properties-system.c |  2 +-
>  include/exec/memory.h|  2 +-
>  include/qom/object.h |  2 +-
>  qom/object.c | 90 
>  4 files changed, 48 insertions(+), 48 deletions(-)

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 :|




Re: [PATCH 1/2] qom: Rename Object::class into Object::klass

2024-06-24 Thread Philippe Mathieu-Daudé

Hi Felix,

On 24/6/24 22:43, Felix Wu wrote:

From: Roman Kiryanov 

'class' is a C++ keyword and it prevents from
using the QEMU headers with a C++ compiler.

Google-Bug-Id: 331190993


I asked Roman twice about this tag meaning:
https://lore.kernel.org/qemu-devel/e865d8e3-e768-4b1f-86d3-aeabe8f1d...@linaro.org/
https://lore.kernel.org/qemu-devel/09b7e7e1-30a6-49d0-a5f8-9cfc62884...@linaro.org/
Since you are taking his work, do you mind clarifying?

Please include a cover letter for your series:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#include-a-meaningful-cover-letter

Also for headers refactors, enabling scripts/git.orderfile helps
reviewers.

Since you are posting different C++ enablement cleanups,
I suggest you add a section in our docs/devel/style.rst
requesting to keep headers C++ compatible, by not using
C++ reserved keywords, etc...
In particular because the mainstream project is not build-testing
for C++, thus we will likely merge patches breaking C++ and
make your life harder. That said, a C++ header smoke-build job
in our CI could help.


Change-Id: I9ab7d2d77edef654a9c7b7cb9cd01795a6ed65a2
Signed-off-by: Felix Wu 
Signed-off-by: Roman Kiryanov 
---
  hw/core/qdev-properties-system.c |  2 +-
  include/exec/memory.h|  2 +-
  include/qom/object.h |  2 +-
  qom/object.c | 90 
  4 files changed, 48 insertions(+), 48 deletions(-)




diff --git a/include/qom/object.h b/include/qom/object.h
index 13d3a655dd..7afdb261a8 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -153,7 +153,7 @@ struct ObjectClass
  struct Object
  {
  /* private: */
-ObjectClass *class;
+ObjectClass *klass;
  ObjectFree *free;
  GHashTable *properties;
  uint32_t ref;


I suppose the OBJECT_CLASS / OBJECT_CLASS_CHECK / OBJECT_GET_CLASS
macros aren't compiled so "class" isn't a problem there.

Since it isn't worst than our INTERFACE_CLASS() use:

Reviewed-by: Philippe Mathieu-Daudé 

Regards,

Phil.