From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 1/5] Use STR() as the only method for performing preprocessor stringificaion Date: Thu, 29 May 2014 08:00:53 +0100 Message-ID: <5386DB25.4050703@citrix.com> References: <1401341669-5237-1-git-send-email-feng.wu@intel.com> <1401341669-5237-2-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1401341669-5237-2-git-send-email-feng.wu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu , xen-devel@lists.xen.org Cc: tim@xen.org, keir.xen@gmail.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org On 29/05/2014 06:34, Feng Wu wrote: > 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 Reviewed-by: Andrew Cooper > --- > 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 > -#include > #include > #include > #include > @@ -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 > - > /* > * 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 > - > /* 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 > #include > -#include > #include > > #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 */