xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Feng Wu <feng.wu@intel.com>
To: xen-devel@lists.xen.org
Cc: Feng Wu <feng.wu@intel.com>,
	ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org,
	keir.xen@gmail.com, stefano.stabellini@citrix.com,
	JBeulich@suse.com
Subject: [PATCH v2 1/5] Use STR() as the only method for performing preprocessor stringificaion
Date: Thu, 29 May 2014 13:34:25 +0800	[thread overview]
Message-ID: <1401341669-5237-2-git-send-email-feng.wu@intel.com> (raw)
In-Reply-To: <1401341669-5237-1-git-send-email-feng.wu@intel.com>

There are two ways of performing preprocessor stringificaion in the
current code: __stringify() from stringify.h, and STR() from config.h.
This patch consolidates down to one.

Signed-off-by: Feng Wu <feng.wu@intel.com>
---
 xen/arch/arm/domain_build.c           |  2 +-
 xen/arch/x86/efi/boot.c               |  3 +--
 xen/include/asm-arm/arm32/processor.h | 10 +++++-----
 xen/include/asm-arm/cpregs.h          |  2 --
 xen/include/asm-arm/sysregs.h         |  2 --
 xen/include/asm-x86/asm_defns.h       |  5 ++---
 xen/include/xen/stringify.h           | 12 ------------
 7 files changed, 9 insertions(+), 27 deletions(-)
 delete mode 100644 xen/include/xen/stringify.h

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c424793..9636097 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -324,7 +324,7 @@ static int make_hypervisor_node(struct domain *d,
                                 void *fdt, const struct dt_device_node *parent)
 {
     const char compat[] =
-        "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0"
+        "xen,xen-"STR(XEN_VERSION)"."STR(XEN_SUBVERSION)"\0"
         "xen,xen";
     __be32 reg[4];
     gic_interrupt_t intr;
diff --git a/xen/arch/x86/efi/boot.c b/xen/arch/x86/efi/boot.c
index a772509..63874df 100644
--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -16,7 +16,6 @@
 # error Cannot use xen/pfn.h here!
 #endif
 #include <xen/string.h>
-#include <xen/stringify.h>
 #include <xen/vga.h>
 #include <asm/e820.h>
 #include <asm/edd.h>
@@ -875,7 +874,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
             StdOut->SetMode(StdOut, best);
     }
 
-    PrintStr(L"Xen " __stringify(XEN_VERSION) "." __stringify(XEN_SUBVERSION)
+    PrintStr(L"Xen " STR(XEN_VERSION) "." STR(XEN_SUBVERSION)
              XEN_EXTRAVERSION " (c/s " XEN_CHANGESET ") EFI loader\r\n");
 
     relocate_image(0);
diff --git a/xen/include/asm-arm/arm32/processor.h b/xen/include/asm-arm/arm32/processor.h
index f41644d..8fe1241 100644
--- a/xen/include/asm-arm/arm32/processor.h
+++ b/xen/include/asm-arm/arm32/processor.h
@@ -64,14 +64,14 @@ struct cpu_user_regs
 #define CP64(r, name...) __CP64(r, name)
 
 /* Stringified for inline assembly */
-#define LOAD_CP32(r, name...)  "mrc " __stringify(CP32(%r, name)) ";"
-#define STORE_CP32(r, name...) "mcr " __stringify(CP32(%r, name)) ";"
-#define LOAD_CP64(r, name...)  "mrrc " __stringify(CP64(%r, %H##r, name)) ";"
-#define STORE_CP64(r, name...) "mcrr " __stringify(CP64(%r, %H##r, name)) ";"
+#define LOAD_CP32(r, name...)  "mrc " STR(CP32(%r, name)) ";"
+#define STORE_CP32(r, name...) "mcr " STR(CP32(%r, name)) ";"
+#define LOAD_CP64(r, name...)  "mrrc " STR(CP64(%r, %H##r, name)) ";"
+#define STORE_CP64(r, name...) "mcrr " STR(CP64(%r, %H##r, name)) ";"
 
 /* Issue a CP operation which takes no argument,
  * uses r0 as a placeholder register. */
-#define CMD_CP32(name...)      "mcr " __stringify(CP32(r0, name)) ";"
+#define CMD_CP32(name...)      "mcr " STR(CP32(r0, name)) ";"
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/asm-arm/cpregs.h
index bf8133e..db1894f 100644
--- a/xen/include/asm-arm/cpregs.h
+++ b/xen/include/asm-arm/cpregs.h
@@ -1,8 +1,6 @@
 #ifndef __ASM_ARM_CPREGS_H
 #define __ASM_ARM_CPREGS_H
 
-#include <xen/stringify.h>
-
 /*
  * AArch32 Co-processor registers.
  *
diff --git a/xen/include/asm-arm/sysregs.h b/xen/include/asm-arm/sysregs.h
index 4a4de34..ced3be7 100644
--- a/xen/include/asm-arm/sysregs.h
+++ b/xen/include/asm-arm/sysregs.h
@@ -3,8 +3,6 @@
 
 #ifdef CONFIG_ARM_64
 
-#include <xen/stringify.h>
-
 /* AArch 64 System Register Encodings */
 #define __HSR_SYSREG_c0  0
 #define __HSR_SYSREG_c1  1
diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index 87a462f..0b9f898 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -8,7 +8,6 @@
 #endif
 #include <asm/processor.h>
 #include <asm/percpu.h>
-#include <xen/stringify.h>
 #include <asm/cpufeature.h>
 
 #ifndef __ASSEMBLY__
@@ -179,13 +178,13 @@ void ret_from_intr(void);
 static inline void clac(void)
 {
     if ( boot_cpu_has(X86_FEATURE_SMAP) )
-        asm volatile (__stringify(__ASM_CLAC) : : : "memory");
+        asm volatile (STR(__ASM_CLAC) : : : "memory");
 }
 
 static inline void stac(void)
 {
     if ( boot_cpu_has(X86_FEATURE_SMAP) )
-        asm volatile (__stringify(__ASM_STAC) : : : "memory");
+        asm volatile (STR(__ASM_STAC) : : : "memory");
 }
 #endif
 
diff --git a/xen/include/xen/stringify.h b/xen/include/xen/stringify.h
deleted file mode 100644
index 36808e0..0000000
--- a/xen/include/xen/stringify.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __XEN_STRINGIFY_H
-#define __XEN_STRINGIFY_H
-
-/* Indirect stringification.  Doing two levels allows the parameter to be a
- * macro itself.  For example, compile with -DFOO=bar, __stringify(FOO)
- * converts to "bar".
- */
-
-#define __stringify_1(x...) #x
-#define __stringify(x...)   __stringify_1(x)
-
-#endif /* !__XEN_STRINGIFY_H */
-- 
1.8.3.1

  reply	other threads:[~2014-05-29  5:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29  5:34 [PATCH v2 0/5] x86: Use alternative mechanism to define CLAC/STAC Feng Wu
2014-05-29  5:34 ` Feng Wu [this message]
2014-05-29  7:00   ` [PATCH v2 1/5] Use STR() as the only method for performing preprocessor stringificaion Andrew Cooper
2014-05-29 15:00   ` Jan Beulich
2014-05-29  5:34 ` [PATCH v2 2/5] x86: Add definitions for NOP operation Feng Wu
2014-05-29  8:43   ` Andrew Cooper
2014-05-29  5:34 ` [PATCH v2 3/5] x86: Make set_nmi_callback return the old nmi callback Feng Wu
2014-05-29  7:01   ` Andrew Cooper
2014-05-29  5:34 ` [PATCH v2 4/5] x86: Port the basic alternative mechanism from Linux to Xen Feng Wu
2014-05-29  8:55   ` Andrew Cooper
2014-05-29  9:28     ` Wu, Feng
2014-05-29 14:59       ` Andrew Cooper
2014-05-30  4:48         ` Wu, Feng
2014-05-30  7:07           ` Jan Beulich
2014-05-29  5:34 ` [PATCH v2 5/5] x86: Use alternative mechanism to define CLAC/STAC Feng Wu
2014-05-29  8:56   ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401341669-5237-2-git-send-email-feng.wu@intel.com \
    --to=feng.wu@intel.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir.xen@gmail.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).