* [PATCH] Stringify support commas
@ 2008-04-20 18:32 Mathieu Desnoyers
2008-04-20 19:06 ` Sam Ravnborg
0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Desnoyers @ 2008-04-20 18:32 UTC (permalink / raw)
To: akpm, linux-kernel
#define MYDEF a, b, c
__stringify(MYDEF) should be replaced by "a, b, c", but compilation fails
because the __stringify macro expects only one argument. Fix it by using
variable macro arguments in __stringify and __stringify_1.
Needed in my current NMI safe iret paravirt support work so I can expand
a macro containing assembly code into a string.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: akpm@osdl.org
---
include/linux/stringify.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6-lttng/include/linux/stringify.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/stringify.h 2008-04-20 14:25:12.000000000 -0400
+++ linux-2.6-lttng/include/linux/stringify.h 2008-04-20 14:25:33.000000000 -0400
@@ -6,7 +6,7 @@
* converts to "bar".
*/
-#define __stringify_1(x) #x
-#define __stringify(x) __stringify_1(x)
+#define __stringify_1(x...) #x
+#define __stringify(x...) __stringify_1(x)
#endif /* !__LINUX_STRINGIFY_H */
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Stringify support commas
2008-04-20 18:32 [PATCH] Stringify support commas Mathieu Desnoyers
@ 2008-04-20 19:06 ` Sam Ravnborg
2008-04-20 21:21 ` Mathieu Desnoyers
0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2008-04-20 19:06 UTC (permalink / raw)
To: Mathieu Desnoyers; +Cc: akpm, linux-kernel
On Sun, Apr 20, 2008 at 02:32:56PM -0400, Mathieu Desnoyers wrote:
> #define MYDEF a, b, c
>
> __stringify(MYDEF) should be replaced by "a, b, c", but compilation fails
> because the __stringify macro expects only one argument. Fix it by using
> variable macro arguments in __stringify and __stringify_1.
>
> Needed in my current NMI safe iret paravirt support work so I can expand
> a macro containing assembly code into a string.
This is a no-no for those archs that still use -traditional.
I dunno if this is a problem for you at the moment and the
right fix is anyway to nuke -traditional.
Sam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Stringify support commas
2008-04-20 19:06 ` Sam Ravnborg
@ 2008-04-20 21:21 ` Mathieu Desnoyers
2008-04-21 6:11 ` Sam Ravnborg
0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Desnoyers @ 2008-04-20 21:21 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: akpm, linux-kernel
* Sam Ravnborg (sam@ravnborg.org) wrote:
> On Sun, Apr 20, 2008 at 02:32:56PM -0400, Mathieu Desnoyers wrote:
> > #define MYDEF a, b, c
> >
> > __stringify(MYDEF) should be replaced by "a, b, c", but compilation fails
> > because the __stringify macro expects only one argument. Fix it by using
> > variable macro arguments in __stringify and __stringify_1.
> >
> > Needed in my current NMI safe iret paravirt support work so I can expand
> > a macro containing assembly code into a string.
>
> This is a no-no for those archs that still use -traditional.
> I dunno if this is a problem for you at the moment and the
> right fix is anyway to nuke -traditional.
>
> Sam
A quick grep through arch/ gives me the following :
arch/cris/arch-v10/boot/compressed/Makefile
@$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
arch/cris/arch-v10/boot/rescue/Makefile
asflags-y += -traditional
arch/cris/arch-v10/lib/Makefile
EXTRA_AFLAGS := -traditional
arch/h8300/boot/compressed/Makefile
EXTRA_AFLAGS := -traditional
arch/m32r/boot/compressed/Makefile
EXTRA_AFLAGS := -traditional
arch/m32r/kernel/Makefile
EXTRA_AFLAGS := -traditional
arch/m68k/fpsp040/Makefile
EXTRA_AFLAGS := -traditional
arch/m68k/ifpsp060/Makefile
EXTRA_AFLAGS := -traditional
arch/m68k/kernel/Makefile
EXTRA_AFLAGS := -traditional
arch/m68k/lib/Makefile
EXTRA_AFLAGS := -traditional
arch/m68k/math-emu/Makefile
EXTRA_AFLAGS := -traditional
arch/parisc/kernel/Makefile
AFLAGS_entry.o := -traditional
AFLAGS_pacache.o := -traditional
arch/powerpc/boot/Makefile
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
arch/s390/kernel/Makefile
EXTRA_AFLAGS := -traditional
arch/s390/lib/Makefile
EXTRA_AFLAGS := -traditional
arch/s390/math-emu/Makefile
EXTRA_AFLAGS := -traditional
arch/sh/boot/compressed/Makefile_32
EXTRA_AFLAGS := -traditional
arch/sh/boot/compressed/Makefile_64
EXTRA_AFLAGS := -traditional
Would their removal break something ?
Mathieu
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Stringify support commas
2008-04-20 21:21 ` Mathieu Desnoyers
@ 2008-04-21 6:11 ` Sam Ravnborg
0 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2008-04-21 6:11 UTC (permalink / raw)
To: Mathieu Desnoyers; +Cc: akpm, linux-kernel
On Sun, Apr 20, 2008 at 05:21:24PM -0400, Mathieu Desnoyers wrote:
> * Sam Ravnborg (sam@ravnborg.org) wrote:
> > On Sun, Apr 20, 2008 at 02:32:56PM -0400, Mathieu Desnoyers wrote:
> > > #define MYDEF a, b, c
> > >
> > > __stringify(MYDEF) should be replaced by "a, b, c", but compilation fails
> > > because the __stringify macro expects only one argument. Fix it by using
> > > variable macro arguments in __stringify and __stringify_1.
> > >
> > > Needed in my current NMI safe iret paravirt support work so I can expand
> > > a macro containing assembly code into a string.
> >
> > This is a no-no for those archs that still use -traditional.
> > I dunno if this is a problem for you at the moment and the
> > right fix is anyway to nuke -traditional.
> >
> > Sam
>
> A quick grep through arch/ gives me the following :
>
> arch/cris/arch-v10/boot/compressed/Makefile
> @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
> arch/cris/arch-v10/boot/rescue/Makefile
> asflags-y += -traditional
> arch/cris/arch-v10/lib/Makefile
> EXTRA_AFLAGS := -traditional
> arch/h8300/boot/compressed/Makefile
> EXTRA_AFLAGS := -traditional
> arch/m32r/boot/compressed/Makefile
> EXTRA_AFLAGS := -traditional
> arch/m32r/kernel/Makefile
> EXTRA_AFLAGS := -traditional
> arch/m68k/fpsp040/Makefile
> EXTRA_AFLAGS := -traditional
> arch/m68k/ifpsp060/Makefile
> EXTRA_AFLAGS := -traditional
> arch/m68k/kernel/Makefile
> EXTRA_AFLAGS := -traditional
> arch/m68k/lib/Makefile
> EXTRA_AFLAGS := -traditional
> arch/m68k/math-emu/Makefile
> EXTRA_AFLAGS := -traditional
> arch/parisc/kernel/Makefile
> AFLAGS_entry.o := -traditional
> AFLAGS_pacache.o := -traditional
> arch/powerpc/boot/Makefile
> BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
> arch/s390/kernel/Makefile
> EXTRA_AFLAGS := -traditional
> arch/s390/lib/Makefile
> EXTRA_AFLAGS := -traditional
> arch/s390/math-emu/Makefile
> EXTRA_AFLAGS := -traditional
> arch/sh/boot/compressed/Makefile_32
> EXTRA_AFLAGS := -traditional
> arch/sh/boot/compressed/Makefile_64
> EXTRA_AFLAGS := -traditional
>
> Would their removal break something ?
I do not recall why they were added but removing -traditional from
x86 was painless.
So a simple approach would be to send a patch towards the arch maintainers.
But even better to try it out with a cross toolchain first.
Any breakage should be obvious.
Sam
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-21 6:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-20 18:32 [PATCH] Stringify support commas Mathieu Desnoyers
2008-04-20 19:06 ` Sam Ravnborg
2008-04-20 21:21 ` Mathieu Desnoyers
2008-04-21 6:11 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox