qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] osdep.h changes for QEMU 6.0-rc3
@ 2021-04-13 12:47 Paolo Bonzini
  2021-04-13 12:47 ` [PULL 1/2] osdep: include glib-compat.h before other QEMU headers Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Paolo Bonzini @ 2021-04-13 12:47 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit c1e90def01bdb8fcbdbebd9d1eaa8e4827ece620:

  Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210412' into staging (2021-04-12 12:12:09 +0100)

are available in the Git repository at:

  https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 12763913a3e44d9968a9ab0da01a0880fc7d61df:

  osdep: protect qemu/osdep.h with extern "C" (2021-04-13 13:00:37 +0200)

----------------------------------------------------------------
Fix C++ compilation of qemu/osdep.h.

----------------------------------------------------------------
Paolo Bonzini (2):
      osdep: include glib-compat.h before other QEMU headers
      osdep: protect qemu/osdep.h with extern "C"

 disas/nanomips.cpp      |  2 +-
 include/qemu/compiler.h |  6 ++++++
 include/qemu/osdep.h    | 13 +++++++++++--
 3 files changed, 18 insertions(+), 3 deletions(-)
-- 
2.30.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/2] osdep: include glib-compat.h before other QEMU headers
  2021-04-13 12:47 [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Paolo Bonzini
@ 2021-04-13 12:47 ` Paolo Bonzini
  2021-04-13 12:48 ` [PULL 2/2] osdep: protect qemu/osdep.h with extern "C" Paolo Bonzini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2021-04-13 12:47 UTC (permalink / raw)
  To: qemu-devel

glib-compat.h is sort of like a system header, and it needs to include
system headers (glib.h) that may dislike being included under
'extern "C"'.  Move it right after all system headers and before
all other QEMU headers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/osdep.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index ba15be9c56..b67b0a1e8c 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -111,6 +111,8 @@ extern int daemon(int, int);
 #define WEXITSTATUS(x) (x)
 #endif
 
+#include "glib-compat.h"
+
 #ifdef _WIN32
 #include "sysemu/os-win32.h"
 #endif
@@ -123,7 +125,6 @@ extern int daemon(int, int);
 #include <AvailabilityMacros.h>
 #endif
 
-#include "glib-compat.h"
 #include "qemu/typedefs.h"
 
 /*
-- 
2.30.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/2] osdep: protect qemu/osdep.h with extern "C"
  2021-04-13 12:47 [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Paolo Bonzini
  2021-04-13 12:47 ` [PULL 1/2] osdep: include glib-compat.h before other QEMU headers Paolo Bonzini
@ 2021-04-13 12:48 ` Paolo Bonzini
  2021-04-13 12:51 ` [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Peter Maydell
  2021-04-13 13:48 ` no-reply
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2021-04-13 12:48 UTC (permalink / raw)
  To: qemu-devel

System headers may include templates if compiled with a C++ compiler,
which cause the compiler to complain if qemu/osdep.h is included
within a C++ source file's 'extern "C"' block.  Add
an 'extern "C"' block directly to qemu/osdep.h, so that
system headers can be kept out of it.

There is a stray declaration early in qemu/osdep.h, which needs
to be special cased.  Add a definition in qemu/compiler.h to
make it look nice.

config-host.h, CONFIG_TARGET, exec/poison.h and qemu/compiler.h
are included outside the 'extern "C"' block; that is not
an issue because they consist entirely of preprocessor directives.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 disas/nanomips.cpp      |  2 +-
 include/qemu/compiler.h |  6 ++++++
 include/qemu/osdep.h    | 10 +++++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 2b09655271..8ddef897f0 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -27,8 +27,8 @@
  *      Reference Manual", Revision 01.01, April 27, 2018
  */
 
-extern "C" {
 #include "qemu/osdep.h"
+extern "C" {
 #include "disas/dis-asm.h"
 }
 
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index cf28bb2bcd..091c45248b 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -11,6 +11,12 @@
 #define QEMU_STATIC_ANALYSIS 1
 #endif
 
+#ifdef __cplusplus
+#define QEMU_EXTERN_C extern "C"
+#else
+#define QEMU_EXTERN_C extern
+#endif
+
 #define QEMU_NORETURN __attribute__ ((__noreturn__))
 
 #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index b67b0a1e8c..3f8785a471 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -57,7 +57,7 @@
 #define daemon qemu_fake_daemon_function
 #include <stdlib.h>
 #undef daemon
-extern int daemon(int, int);
+QEMU_EXTERN_C int daemon(int, int);
 #endif
 
 #ifdef _WIN32
@@ -113,6 +113,10 @@ extern int daemon(int, int);
 
 #include "glib-compat.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef _WIN32
 #include "sysemu/os-win32.h"
 #endif
@@ -723,4 +727,8 @@ static inline int platform_does_not_support_system(const char *command)
 }
 #endif /* !HAVE_SYSTEM_FUNCTION */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
2.30.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/2] osdep.h changes for QEMU 6.0-rc3
  2021-04-13 12:47 [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Paolo Bonzini
  2021-04-13 12:47 ` [PULL 1/2] osdep: include glib-compat.h before other QEMU headers Paolo Bonzini
  2021-04-13 12:48 ` [PULL 2/2] osdep: protect qemu/osdep.h with extern "C" Paolo Bonzini
@ 2021-04-13 12:51 ` Peter Maydell
  2021-04-13 13:48 ` no-reply
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2021-04-13 12:51 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On Tue, 13 Apr 2021 at 13:50, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit c1e90def01bdb8fcbdbebd9d1eaa8e4827ece620:
>
>   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210412' into staging (2021-04-12 12:12:09 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to 12763913a3e44d9968a9ab0da01a0880fc7d61df:
>
>   osdep: protect qemu/osdep.h with extern "C" (2021-04-13 13:00:37 +0200)
>
> ----------------------------------------------------------------
> Fix C++ compilation of qemu/osdep.h.

I had some unaddressed review comments on patch 2...

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PULL 0/2] osdep.h changes for QEMU 6.0-rc3
  2021-04-13 12:47 [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2021-04-13 12:51 ` [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Peter Maydell
@ 2021-04-13 13:48 ` no-reply
  3 siblings, 0 replies; 5+ messages in thread
From: no-reply @ 2021-04-13 13:48 UTC (permalink / raw)
  To: pbonzini; +Cc: qemu-devel

Patchew URL: https://patchew.org/QEMU/20210413124800.216095-1-pbonzini@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210413124800.216095-1-pbonzini@redhat.com
Subject: [PULL 0/2] osdep.h changes for QEMU 6.0-rc3

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
2f6308e osdep: protect qemu/osdep.h with extern "C"
9aed404 osdep: include glib-compat.h before other QEMU headers

=== OUTPUT BEGIN ===
1/2 Checking commit 9aed404591cb (osdep: include glib-compat.h before other QEMU headers)
2/2 Checking commit 2f6308e1b524 (osdep: protect qemu/osdep.h with extern "C")
WARNING: architecture specific defines should be avoided
#51: FILE: include/qemu/compiler.h:14:
+#ifdef __cplusplus

ERROR: storage class should be at the beginning of the declaration
#52: FILE: include/qemu/compiler.h:15:
+#define QEMU_EXTERN_C extern "C"

ERROR: storage class should be at the beginning of the declaration
#54: FILE: include/qemu/compiler.h:17:
+#define QEMU_EXTERN_C extern

WARNING: architecture specific defines should be avoided
#77: FILE: include/qemu/osdep.h:116:
+#ifdef __cplusplus

WARNING: architecture specific defines should be avoided
#88: FILE: include/qemu/osdep.h:730:
+#ifdef __cplusplus

total: 2 errors, 3 warnings, 47 lines checked

Patch 2/2 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210413124800.216095-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-13 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 12:47 [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Paolo Bonzini
2021-04-13 12:47 ` [PULL 1/2] osdep: include glib-compat.h before other QEMU headers Paolo Bonzini
2021-04-13 12:48 ` [PULL 2/2] osdep: protect qemu/osdep.h with extern "C" Paolo Bonzini
2021-04-13 12:51 ` [PULL 0/2] osdep.h changes for QEMU 6.0-rc3 Peter Maydell
2021-04-13 13:48 ` no-reply

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).