Hi Jason,

Sorry I must have misunderstood you. I thought the patch was already
approved earlier and I did commit. I can revert or do additional
changes.

On Tue, Jun 11, 2024 at 04:31:30PM -0400, Jason Merrill wrote:
> > +  if (tok->type == CPP_OPEN_PAREN)
> > +    {
> > +      matching_parens parens;
> > +      parens.consume_open (parser);
> > +      tree string = cp_parser_constant_expression (parser);
> > +      if (string != error_mark_node)
> > +   string = cxx_constant_value (string, tf_error);
> > +      if (TREE_CODE (string) == NOP_EXPR)
> > +   string = TREE_OPERAND (string, 0);
> > +      if (TREE_CODE (string) == ADDR_EXPR
> > +     && TREE_CODE (TREE_OPERAND (string, 0)) == STRING_CST)
> > +   string = TREE_OPERAND (string, 0);
> > +      if (TREE_CODE (string) == VIEW_CONVERT_EXPR)
> > +   string = TREE_OPERAND (string, 0);
> 
> What in the testcases needs this wrapper stripping?

Without the stripping I get

/home/ak/gcc/gcc/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-1.C: In
function 'void f()':
/home/ak/gcc/gcc/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-1.C:27:16:
error: request for member 'size' in '(const char*)"foo %1,%0"', which is
of non-class type 'const char*'
/home/ak/gcc/gcc/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-1.C:27:7:
error: constexpr string must be a string literal or object with 'size'
and 'data' members
/home/ak/gcc/gcc/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-1.C:27:19:
error: expected primary-expression before ':' token
compiler exited with status 1

presumably because it fails this test:


  if (TREE_CODE (message) != STRING_CST
        && !type_dependent_expression_p (message))

> > +      cexpr_str cstr (string);
> > +      if (!cstr.type_check (tok->location))
> > +   return error_mark_node;
> 
> > +      const char *msg;
> > +      int len;
> > +      if (!cstr.extract (tok->location, msg, len))
> > +   return error_mark_node;
> > +      parens.require_close (parser);
> > +      string = build_string (len, msg);
> 
> mayb cexpr_str should have a function to return a STRING_CST?

Okay I can add that.

> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -10700,14 +10700,30 @@ contain any instructions recognized by the 
> > assembler, including directives.
> >   GCC does not parse the assembler instructions themselves and
> >   does not know what they mean or even whether they are valid assembler 
> > input.
> > -You may place multiple assembler instructions together in a single 
> > @code{asm}
> > -string, separated by the characters normally used in assembly code for the
> > -system. A combination that works in most places is a newline to break the
> > +You may place multiple assembler instructions together in a single 
> > @code{asm}
> > +string, separated by the characters normally used in assembly code for the
> > +system. A combination that works in most places is a newline to break the
> >   line, plus a tab character (written as @samp{\n\t}).
> > -Some assemblers allow semicolons as a line separator. However,
> > -note that some assembler dialects use semicolons to start a comment.
> > +Some assemblers allow semicolons as a line separator. However,
> > +note that some assembler dialects use semicolons to start a comment.
> 
> Why is diff flagging the above as a change?  I don't see any difference.

Strange, but I don't know. I don't see a white space change.

-Andi

Reply via email to