qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] disas: Fix build with glib2.0 >=2.67.3
@ 2021-02-23 14:56 Christian Ehrhardt
  2021-02-23 15:43 ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Christian Ehrhardt @ 2021-02-23 14:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Christian Ehrhardt

glib2.0 introduced a change in 2.67.3 and later which triggers an
issue [1] for anyone including it's headers in a "extern C" context
which a few files in disas/* do. An example of such an include chain
and error look like:

../../disas/arm-a64.cc
In file included from /usr/include/glib-2.0/glib/gmacros.h:241,
                 from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from /<<BUILDDIR>>/qemu-5.2+dfsg/include/glib-compat.h:32,
                 from /<<BUILDDIR>>/qemu-5.2+dfsg/include/qemu/osdep.h:126,
                 from ../../disas/arm-a64.cc:21:
/usr/include/c++/10/type_traits:56:3: error: template with C linkage
   56 |   template<typename _Tp, _Tp __v>
      |   ^~~~~~~~
../../disas/arm-a64.cc:20:1: note: ‘extern "C"’ linkage started here
   20 | extern "C" {
      | ^~~~~~~~~~

To fix that move the include of osdep.h out of that section. It was added
already as C++ fixup by e78490c44: "disas/arm-a64.cc: Include osdep.h first".

[1]: https://gitlab.gnome.org/GNOME/glib/-/issues/2331

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 disas/arm-a64.cc   | 2 +-
 disas/nanomips.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
index 9fa779e175..27613d4b25 100644
--- a/disas/arm-a64.cc
+++ b/disas/arm-a64.cc
@@ -17,8 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-extern "C" {
 #include "qemu/osdep.h"
+extern "C" {
 #include "disas/dis-asm.h"
 }
 
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 90e63b8367..3c202075cc 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"
 }
 
-- 
2.30.0



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

end of thread, other threads:[~2021-03-08 14:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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é
2021-03-08 13:50             ` Christian Ehrhardt
2021-03-08 13:55               ` Daniel P. Berrangé

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