Currently libxl and the x86-emulator tests carry their own versions. Factor
those out into the common macros header so every library can make use of
it. This is required so the following patch can add this macro to a header
used both in Xen and tools/libs.
No functional change.
Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
tools/include/xen-tools/common-macros.h | 3 +++
tools/libs/light/libxl_internal.h | 2 --
tools/tests/x86_emulator/x86-emulate.h | 3 ---
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h
index 168691be0e..6d7de1bc0a 100644
--- a/tools/include/xen-tools/common-macros.h
+++ b/tools/include/xen-tools/common-macros.h
@@ -84,4 +84,7 @@
(type *)((char *)mptr__ - offsetof(type, member)); \
})
+#define __AC(X,Y) (X##Y)
+#define _AC(X,Y) __AC(X,Y)
+
#endif /* __XEN_TOOLS_COMMON_MACROS__ */
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 61f4fe1dec..1cf3d400bf 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -125,8 +125,6 @@
#define PVSHIM_CMDLINE "pv-shim console=xen,pv"
/* Size macros. */
-#define __AC(X,Y) (X##Y)
-#define _AC(X,Y) __AC(X,Y)
#define MB(_mb) (_AC(_mb, ULL) << 20)
#define GB(_gb) (_AC(_gb, ULL) << 30)
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index aa1ed75ec8..350d1a0abf 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -59,9 +59,6 @@
#define cf_check /* No Control Flow Integriy checking */
-#define AC_(n,t) (n##t)
-#define _AC(n,t) AC_(n,t)
-
#ifdef __GCC_ASM_FLAG_OUTPUTS__
# define ASM_FLAG_OUT(yes, no) yes
#else
--
2.34.1
On Thu, Jun 29, 2023 at 1:17 PM Alejandro Vallejo < alejandro.vallejo@cloud.com> wrote: > Currently libxl and the x86-emulator tests carry their own versions. Factor > those out into the common macros header so every library can make use of > it. This is required so the following patch can add this macro to a header > used both in Xen and tools/libs. > > No functional change. > > Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com> > --- > tools/include/xen-tools/common-macros.h | 3 +++ > tools/libs/light/libxl_internal.h | 2 -- > tools/tests/x86_emulator/x86-emulate.h | 3 --- > 3 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/tools/include/xen-tools/common-macros.h > b/tools/include/xen-tools/common-macros.h > index 168691be0e..6d7de1bc0a 100644 > --- a/tools/include/xen-tools/common-macros.h > +++ b/tools/include/xen-tools/common-macros.h > @@ -84,4 +84,7 @@ > (type *)((char *)mptr__ - offsetof(type, member)); \ > }) > > +#define __AC(X,Y) (X##Y) > +#define _AC(X,Y) __AC(X,Y) > + > #endif /* __XEN_TOOLS_COMMON_MACROS__ */ > diff --git a/tools/libs/light/libxl_internal.h > b/tools/libs/light/libxl_internal.h > index 61f4fe1dec..1cf3d400bf 100644 > --- a/tools/libs/light/libxl_internal.h > +++ b/tools/libs/light/libxl_internal.h > @@ -125,8 +125,6 @@ > #define PVSHIM_CMDLINE "pv-shim console=xen,pv" > > /* Size macros. */ > -#define __AC(X,Y) (X##Y) > -#define _AC(X,Y) __AC(X,Y) > #define MB(_mb) (_AC(_mb, ULL) << 20) > #define GB(_gb) (_AC(_gb, ULL) << 30) > > diff --git a/tools/tests/x86_emulator/x86-emulate.h > b/tools/tests/x86_emulator/x86-emulate.h > index aa1ed75ec8..350d1a0abf 100644 > --- a/tools/tests/x86_emulator/x86-emulate.h > +++ b/tools/tests/x86_emulator/x86-emulate.h > @@ -59,9 +59,6 @@ > > #define cf_check /* No Control Flow Integriy checking */ > > -#define AC_(n,t) (n##t) > -#define _AC(n,t) AC_(n,t) > - > #ifdef __GCC_ASM_FLAG_OUTPUTS__ > # define ASM_FLAG_OUT(yes, no) yes > #else > -- > 2.34.1 > @mantainers
On 29/06/2023 1:17 pm, Alejandro Vallejo wrote: > Currently libxl and the x86-emulator tests carry their own versions. Factor > those out into the common macros header so every library can make use of > it. This is required so the following patch can add this macro to a header > used both in Xen and tools/libs. > > No functional change. > > Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, although ... > --- > tools/include/xen-tools/common-macros.h | 3 +++ > tools/libs/light/libxl_internal.h | 2 -- > tools/tests/x86_emulator/x86-emulate.h | 3 --- > 3 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h > index 168691be0e..6d7de1bc0a 100644 > --- a/tools/include/xen-tools/common-macros.h > +++ b/tools/include/xen-tools/common-macros.h > @@ -84,4 +84,7 @@ > (type *)((char *)mptr__ - offsetof(type, member)); \ > }) > > +#define __AC(X,Y) (X##Y) > +#define _AC(X,Y) __AC(X,Y) ... I'll take the opportunity to do style fixes here. ~Andrew
© 2016 - 2026 Red Hat, Inc.