[3/4] gcc/c-family/c-opts: fix quoting for `-fdeps-format=` error message

Message ID 20240504150446.473575-4-ben.boeckel@kitware.com
State New
Headers
Series P1689 followup fixes |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm fail Testing failed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 fail Testing failed

Commit Message

Ben Boeckel May 4, 2024, 3:04 p.m. UTC
  Fixes: 024f135a1e9 (p1689r5: initial support, 2023-09-01)

Reported-by: Roland Illig <roland.illig@gmx.de>

gcc/c-family/

	* c-opts.cc (c_common_handle_option): Fix quoting in
	`-fdeps-format=` unrecognized parameter error message.

Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
---
 gcc/c-family/c-opts.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Joseph Myers May 7, 2024, 9:15 p.m. UTC | #1
On Sat, 4 May 2024, Ben Boeckel wrote:

> diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
> index be3058dca63..4a164ad0c0b 100644
> --- a/gcc/c-family/c-opts.cc
> +++ b/gcc/c-family/c-opts.cc
> @@ -370,7 +370,7 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
>        if (!strcmp (arg, "p1689r5"))
>  	cpp_opts->deps.fdeps_format = FDEPS_FMT_P1689R5;
>        else
> -	error ("%<-fdeps-format=%> unknown format %<%s%>", arg);
> +	error ("%<-fdeps-format=%> unknown format %q", arg);
>        break;

That can't be right.  The GCC %q is a modifier that needs to have an 
actual format specifier it modifies (so %qs - which produces the same 
output as %<%s%> - but not %q by itself).
  
Ben Boeckel May 8, 2024, 11:26 a.m. UTC | #2
On Tue, May 07, 2024 at 21:15:09 +0000, Joseph Myers wrote:
> That can't be right.  The GCC %q is a modifier that needs to have an 
> actual format specifier it modifies (so %qs - which produces the same 
> output as %<%s%> - but not %q by itself).

Yes, I got CI results of failure and noticed that I had prepared the
patches on my laptop, but when I investigated, I had done additional
work on my desktop concurrently I had not pulled back (it builds GCC in
a…reasonable time comparatively) which did have the `%qs` change, but
I've not gotten around to running the test suite again (or reporting
back here). I have another patch revision in the works.

Thanks,

--Ben
  

Patch

diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index be3058dca63..4a164ad0c0b 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -370,7 +370,7 @@  c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
       if (!strcmp (arg, "p1689r5"))
 	cpp_opts->deps.fdeps_format = FDEPS_FMT_P1689R5;
       else
-	error ("%<-fdeps-format=%> unknown format %<%s%>", arg);
+	error ("%<-fdeps-format=%> unknown format %q", arg);
       break;
 
     case OPT_fdeps_file_: