Re: [PATCH v1] C++: Support constexpr strings for asm statements

2024-03-15 Thread Andi Kleen
> > I think keeping it untranslated is fine for now. Any translation > > if really needed would be a separate feature. > > I mean, unless you make extra effort, it is translated. > Even in your current version, try constexpr *foo () { return "nop"; } > and you'll see that it actually results in "\

Re: [PATCH v1] C++: Support constexpr strings for asm statements

2024-03-15 Thread Jakub Jelinek
On Fri, Mar 15, 2024 at 10:20:06AM -0700, Andi Kleen wrote: > > One issue is the character set question. The strings in inline asm right > > now are untranslated, i.e. remain in SOURCE_CHARSET, usually UTF-8 (in > > theory there is also UTF-EBCDIC support, but nobody knows if it actually > > works

Re: [PATCH v1] C++: Support constexpr strings for asm statements

2024-03-15 Thread Andi Kleen
Thanks Jakub. > > +/* Parse a string literal or constant expression yielding a string. > > + The constant expression uses extra parens to avoid ambiguity with "x" > > (expr). > > + > > + asm-string-expr: > > + string-literal > > + ( constant-expr ) */ > > + > > +static tree > > +cp_pa

Re: [PATCH v1] C++: Support constexpr strings for asm statements

2024-03-15 Thread Jakub Jelinek
On Thu, Jan 25, 2024 at 04:18:19AM -0800, Andi Kleen wrote: > Some programing styles use a lot of inline assembler, and it is common > to use very complex preprocessor macros to generate the assembler > strings for the asm statements. In C++ there would be a typesafe alternative > using templates a

[PATCH v1] C++: Support constexpr strings for asm statements

2024-01-25 Thread Andi Kleen
Some programing styles use a lot of inline assembler, and it is common to use very complex preprocessor macros to generate the assembler strings for the asm statements. In C++ there would be a typesafe alternative using templates and constexpr to generate the assembler strings, but unfortunately th