* [PATCH v2] disas/libvixl: Protect C system header for C++ compiler
@ 2021-05-16 17:10 Philippe Mathieu-Daudé
2021-05-17 9:55 ` Thomas Huth
2021-05-25 7:47 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-16 17:10 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
Richard Henderson, Michael Tokarev, Philippe Mathieu-Daudé,
qemu-arm, Paolo Bonzini
When selecting an ARM target on Debian unstable, we get:
Compiling C++ object libcommon.fa.p/disas_libvixl_vixl_utils.cc.o
FAILED: libcommon.fa.p/disas_libvixl_vixl_utils.cc.o
c++ -Ilibcommon.fa.p -I. -I.. [...] -o libcommon.fa.p/disas_libvixl_vixl_utils.cc.o -c ../disas/libvixl/vixl/utils.cc
In file included from /home/philmd/qemu/disas/libvixl/vixl/utils.h:30,
from ../disas/libvixl/vixl/utils.cc:27:
/usr/include/string.h:36:43: error: missing binary operator before token "("
36 | #if defined __cplusplus && (__GNUC_PREREQ (4, 4) \
| ^
/usr/include/string.h:53:62: error: missing binary operator before token "("
53 | #if defined __USE_MISC || defined __USE_XOPEN || __GLIBC_USE (ISOC2X)
| ^
/usr/include/string.h:165:21: error: missing binary operator before token "("
165 | || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X))
| ^
/usr/include/string.h:174:43: error: missing binary operator before token "("
174 | #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X)
| ^
/usr/include/string.h:492:19: error: missing binary operator before token "("
492 | #if __GNUC_PREREQ (3,4)
| ^
Relevant information from the host:
$ lsb_release -d
Description: Debian GNU/Linux 11 (bullseye)
$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
$ dpkg -S /usr/include/string.h
libc6-dev: /usr/include/string.h
$ apt-cache show libc6-dev
Package: libc6-dev
Version: 2.31-11
Partially cherry-pick vixl commit 78973f258039f6e96 [*]:
Refactor VIXL to use `extern` block when including C header
that do not have a C++ counterpart.
which is similar to commit 875df03b221 ('osdep: protect qemu/osdep.h
with extern "C"').
[*] https://git.linaro.org/arm/vixl.git/commit/?id=78973f258039f6e96
Buglink: https://bugs.launchpad.net/qemu/+bug/1914870
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
disas/libvixl/vixl/code-buffer.h | 2 +-
disas/libvixl/vixl/globals.h | 16 +++++++++-------
disas/libvixl/vixl/invalset.h | 2 +-
disas/libvixl/vixl/platform.h | 2 ++
disas/libvixl/vixl/utils.h | 2 +-
disas/libvixl/vixl/utils.cc | 2 +-
6 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/disas/libvixl/vixl/code-buffer.h b/disas/libvixl/vixl/code-buffer.h
index f93ebb6b822..b95babbdee2 100644
--- a/disas/libvixl/vixl/code-buffer.h
+++ b/disas/libvixl/vixl/code-buffer.h
@@ -27,7 +27,7 @@
#ifndef VIXL_CODE_BUFFER_H
#define VIXL_CODE_BUFFER_H
-#include <string.h>
+#include <cstring>
#include "vixl/globals.h"
namespace vixl {
diff --git a/disas/libvixl/vixl/globals.h b/disas/libvixl/vixl/globals.h
index 7099aa599fb..3a71942f1e5 100644
--- a/disas/libvixl/vixl/globals.h
+++ b/disas/libvixl/vixl/globals.h
@@ -40,15 +40,17 @@
#define __STDC_FORMAT_MACROS
#endif
-#include <stdint.h>
+extern "C" {
#include <inttypes.h>
-
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
#include <stdint.h>
-#include <stdlib.h>
-#include <stddef.h>
+}
+
+#include <cassert>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+
#include "vixl/platform.h"
diff --git a/disas/libvixl/vixl/invalset.h b/disas/libvixl/vixl/invalset.h
index ffdc0237b47..2e0871f8c3f 100644
--- a/disas/libvixl/vixl/invalset.h
+++ b/disas/libvixl/vixl/invalset.h
@@ -27,7 +27,7 @@
#ifndef VIXL_INVALSET_H_
#define VIXL_INVALSET_H_
-#include <string.h>
+#include <cstring>
#include <algorithm>
#include <vector>
diff --git a/disas/libvixl/vixl/platform.h b/disas/libvixl/vixl/platform.h
index ab588f07f54..26a74de81bb 100644
--- a/disas/libvixl/vixl/platform.h
+++ b/disas/libvixl/vixl/platform.h
@@ -28,7 +28,9 @@
#define PLATFORM_H
// Define platform specific functionalities.
+extern "C" {
#include <signal.h>
+}
namespace vixl {
inline void HostBreakpoint() { raise(SIGINT); }
diff --git a/disas/libvixl/vixl/utils.h b/disas/libvixl/vixl/utils.h
index 5ab134e240a..ecb0f1014ab 100644
--- a/disas/libvixl/vixl/utils.h
+++ b/disas/libvixl/vixl/utils.h
@@ -27,8 +27,8 @@
#ifndef VIXL_UTILS_H
#define VIXL_UTILS_H
-#include <string.h>
#include <cmath>
+#include <cstring>
#include "vixl/globals.h"
#include "vixl/compiler-intrinsics.h"
diff --git a/disas/libvixl/vixl/utils.cc b/disas/libvixl/vixl/utils.cc
index 3b8bd75fba1..69304d266d7 100644
--- a/disas/libvixl/vixl/utils.cc
+++ b/disas/libvixl/vixl/utils.cc
@@ -25,7 +25,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vixl/utils.h"
-#include <stdio.h>
+#include <cstdio>
namespace vixl {
--
2.26.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] disas/libvixl: Protect C system header for C++ compiler
2021-05-16 17:10 [PATCH v2] disas/libvixl: Protect C system header for C++ compiler Philippe Mathieu-Daudé
@ 2021-05-17 9:55 ` Thomas Huth
2021-05-25 7:47 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2021-05-17 9:55 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, Daniel P . Berrangé,
Richard Henderson, Michael Tokarev, qemu-arm, Paolo Bonzini
On 16/05/2021 19.10, Philippe Mathieu-Daudé wrote:
> When selecting an ARM target on Debian unstable, we get:
>
> Compiling C++ object libcommon.fa.p/disas_libvixl_vixl_utils.cc.o
> FAILED: libcommon.fa.p/disas_libvixl_vixl_utils.cc.o
> c++ -Ilibcommon.fa.p -I. -I.. [...] -o libcommon.fa.p/disas_libvixl_vixl_utils.cc.o -c ../disas/libvixl/vixl/utils.cc
> In file included from /home/philmd/qemu/disas/libvixl/vixl/utils.h:30,
> from ../disas/libvixl/vixl/utils.cc:27:
> /usr/include/string.h:36:43: error: missing binary operator before token "("
> 36 | #if defined __cplusplus && (__GNUC_PREREQ (4, 4) \
> | ^
> /usr/include/string.h:53:62: error: missing binary operator before token "("
> 53 | #if defined __USE_MISC || defined __USE_XOPEN || __GLIBC_USE (ISOC2X)
> | ^
> /usr/include/string.h:165:21: error: missing binary operator before token "("
> 165 | || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X))
> | ^
> /usr/include/string.h:174:43: error: missing binary operator before token "("
> 174 | #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X)
> | ^
> /usr/include/string.h:492:19: error: missing binary operator before token "("
> 492 | #if __GNUC_PREREQ (3,4)
> | ^
>
> Relevant information from the host:
>
> $ lsb_release -d
> Description: Debian GNU/Linux 11 (bullseye)
> $ gcc --version
> gcc (Debian 10.2.1-6) 10.2.1 20210110
> $ dpkg -S /usr/include/string.h
> libc6-dev: /usr/include/string.h
> $ apt-cache show libc6-dev
> Package: libc6-dev
> Version: 2.31-11
>
> Partially cherry-pick vixl commit 78973f258039f6e96 [*]:
>
> Refactor VIXL to use `extern` block when including C header
> that do not have a C++ counterpart.
>
> which is similar to commit 875df03b221 ('osdep: protect qemu/osdep.h
> with extern "C"').
>
> [*] https://git.linaro.org/arm/vixl.git/commit/?id=78973f258039f6e96
>
> Buglink: https://bugs.launchpad.net/qemu/+bug/1914870
> Suggested-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> disas/libvixl/vixl/code-buffer.h | 2 +-
> disas/libvixl/vixl/globals.h | 16 +++++++++-------
> disas/libvixl/vixl/invalset.h | 2 +-
> disas/libvixl/vixl/platform.h | 2 ++
> disas/libvixl/vixl/utils.h | 2 +-
> disas/libvixl/vixl/utils.cc | 2 +-
> 6 files changed, 15 insertions(+), 11 deletions(-)
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] disas/libvixl: Protect C system header for C++ compiler
2021-05-16 17:10 [PATCH v2] disas/libvixl: Protect C system header for C++ compiler Philippe Mathieu-Daudé
2021-05-17 9:55 ` Thomas Huth
@ 2021-05-25 7:47 ` Philippe Mathieu-Daudé
2021-05-25 9:11 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-25 7:47 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Thomas Huth, Daniel P . Berrangé,
Michael Tokarev, Richard Henderson, qemu-arm, Paolo Bonzini
Hi Peter, since libvixl is mostly used by the Aarch64 target,
can you take this patch via your ARM tree? (Thomas reviewed
it).
On 5/16/21 7:10 PM, Philippe Mathieu-Daudé wrote:
> When selecting an ARM target on Debian unstable, we get:
>
> Compiling C++ object libcommon.fa.p/disas_libvixl_vixl_utils.cc.o
> FAILED: libcommon.fa.p/disas_libvixl_vixl_utils.cc.o
> c++ -Ilibcommon.fa.p -I. -I.. [...] -o libcommon.fa.p/disas_libvixl_vixl_utils.cc.o -c ../disas/libvixl/vixl/utils.cc
> In file included from /home/philmd/qemu/disas/libvixl/vixl/utils.h:30,
> from ../disas/libvixl/vixl/utils.cc:27:
> /usr/include/string.h:36:43: error: missing binary operator before token "("
> 36 | #if defined __cplusplus && (__GNUC_PREREQ (4, 4) \
> | ^
> /usr/include/string.h:53:62: error: missing binary operator before token "("
> 53 | #if defined __USE_MISC || defined __USE_XOPEN || __GLIBC_USE (ISOC2X)
> | ^
> /usr/include/string.h:165:21: error: missing binary operator before token "("
> 165 | || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X))
> | ^
> /usr/include/string.h:174:43: error: missing binary operator before token "("
> 174 | #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X)
> | ^
> /usr/include/string.h:492:19: error: missing binary operator before token "("
> 492 | #if __GNUC_PREREQ (3,4)
> | ^
>
> Relevant information from the host:
>
> $ lsb_release -d
> Description: Debian GNU/Linux 11 (bullseye)
> $ gcc --version
> gcc (Debian 10.2.1-6) 10.2.1 20210110
> $ dpkg -S /usr/include/string.h
> libc6-dev: /usr/include/string.h
> $ apt-cache show libc6-dev
> Package: libc6-dev
> Version: 2.31-11
>
> Partially cherry-pick vixl commit 78973f258039f6e96 [*]:
>
> Refactor VIXL to use `extern` block when including C header
> that do not have a C++ counterpart.
>
> which is similar to commit 875df03b221 ('osdep: protect qemu/osdep.h
> with extern "C"').
>
> [*] https://git.linaro.org/arm/vixl.git/commit/?id=78973f258039f6e96
>
> Buglink: https://bugs.launchpad.net/qemu/+bug/1914870
> Suggested-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> disas/libvixl/vixl/code-buffer.h | 2 +-
> disas/libvixl/vixl/globals.h | 16 +++++++++-------
> disas/libvixl/vixl/invalset.h | 2 +-
> disas/libvixl/vixl/platform.h | 2 ++
> disas/libvixl/vixl/utils.h | 2 +-
> disas/libvixl/vixl/utils.cc | 2 +-
> 6 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/disas/libvixl/vixl/code-buffer.h b/disas/libvixl/vixl/code-buffer.h
> index f93ebb6b822..b95babbdee2 100644
> --- a/disas/libvixl/vixl/code-buffer.h
> +++ b/disas/libvixl/vixl/code-buffer.h
> @@ -27,7 +27,7 @@
> #ifndef VIXL_CODE_BUFFER_H
> #define VIXL_CODE_BUFFER_H
>
> -#include <string.h>
> +#include <cstring>
> #include "vixl/globals.h"
>
> namespace vixl {
> diff --git a/disas/libvixl/vixl/globals.h b/disas/libvixl/vixl/globals.h
> index 7099aa599fb..3a71942f1e5 100644
> --- a/disas/libvixl/vixl/globals.h
> +++ b/disas/libvixl/vixl/globals.h
> @@ -40,15 +40,17 @@
> #define __STDC_FORMAT_MACROS
> #endif
>
> -#include <stdint.h>
> +extern "C" {
> #include <inttypes.h>
> -
> -#include <assert.h>
> -#include <stdarg.h>
> -#include <stdio.h>
> #include <stdint.h>
> -#include <stdlib.h>
> -#include <stddef.h>
> +}
> +
> +#include <cassert>
> +#include <cstdarg>
> +#include <cstddef>
> +#include <cstdio>
> +#include <cstdlib>
> +
> #include "vixl/platform.h"
>
>
> diff --git a/disas/libvixl/vixl/invalset.h b/disas/libvixl/vixl/invalset.h
> index ffdc0237b47..2e0871f8c3f 100644
> --- a/disas/libvixl/vixl/invalset.h
> +++ b/disas/libvixl/vixl/invalset.h
> @@ -27,7 +27,7 @@
> #ifndef VIXL_INVALSET_H_
> #define VIXL_INVALSET_H_
>
> -#include <string.h>
> +#include <cstring>
>
> #include <algorithm>
> #include <vector>
> diff --git a/disas/libvixl/vixl/platform.h b/disas/libvixl/vixl/platform.h
> index ab588f07f54..26a74de81bb 100644
> --- a/disas/libvixl/vixl/platform.h
> +++ b/disas/libvixl/vixl/platform.h
> @@ -28,7 +28,9 @@
> #define PLATFORM_H
>
> // Define platform specific functionalities.
> +extern "C" {
> #include <signal.h>
> +}
>
> namespace vixl {
> inline void HostBreakpoint() { raise(SIGINT); }
> diff --git a/disas/libvixl/vixl/utils.h b/disas/libvixl/vixl/utils.h
> index 5ab134e240a..ecb0f1014ab 100644
> --- a/disas/libvixl/vixl/utils.h
> +++ b/disas/libvixl/vixl/utils.h
> @@ -27,8 +27,8 @@
> #ifndef VIXL_UTILS_H
> #define VIXL_UTILS_H
>
> -#include <string.h>
> #include <cmath>
> +#include <cstring>
> #include "vixl/globals.h"
> #include "vixl/compiler-intrinsics.h"
>
> diff --git a/disas/libvixl/vixl/utils.cc b/disas/libvixl/vixl/utils.cc
> index 3b8bd75fba1..69304d266d7 100644
> --- a/disas/libvixl/vixl/utils.cc
> +++ b/disas/libvixl/vixl/utils.cc
> @@ -25,7 +25,7 @@
> // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> #include "vixl/utils.h"
> -#include <stdio.h>
> +#include <cstdio>
>
> namespace vixl {
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] disas/libvixl: Protect C system header for C++ compiler
2021-05-25 7:47 ` Philippe Mathieu-Daudé
@ 2021-05-25 9:11 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-05-25 9:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Thomas Huth, Daniel P . Berrangé,
Michael Tokarev, Richard Henderson, QEMU Developers, qemu-arm,
Paolo Bonzini
On Tue, 25 May 2021 at 08:47, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Hi Peter, since libvixl is mostly used by the Aarch64 target,
> can you take this patch via your ARM tree? (Thomas reviewed
> it).
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-25 9:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-16 17:10 [PATCH v2] disas/libvixl: Protect C system header for C++ compiler Philippe Mathieu-Daudé
2021-05-17 9:55 ` Thomas Huth
2021-05-25 7:47 ` Philippe Mathieu-Daudé
2021-05-25 9:11 ` Peter Maydell
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.