[PATCH] riscv: fix -Wformat-diag errors.

Joseph Myers joseph@codesourcery.com
Tue Jan 18 22:00:38 GMT 2022


On Tue, 18 Jan 2022, Martin Liška wrote:

> @@ -3309,8 +3309,8 @@ riscv_handle_type_attribute (tree *node
> ATTRIBUTE_UNUSED, tree name, tree args,
>  	      && strcmp (string, "machine"))
>  	    {
>  	      warning (OPT_Wattributes,
> -		       "argument to %qE attribute is not \"user\",
> \"supervisor\", or \"machine\"",
> -		       name);
> +		       "argument to %qE attribute is not %<user%>,
> %<supervisor%>, "
> +		       "or %<machine%>", name);
>  	      *no_add_attrs = true;

My reading is that the attribute arguments here are string constants, not 
identifiers - that is, the ASCII double quotes are correct in the 
diagnostic output, because those double quotes are part of the literal 
text that's supposed to appear in the program.  (Maybe %<\"user\"%> is the 
right way of marking it up to indicate that the double quotes are part of 
the literal program text, not English-level quoting.)

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Gcc-patches mailing list