public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC nvptx: Silence warning?
@ 2023-06-23 21:08 Jan-Benedict Glaw
  0 siblings, 0 replies; only message in thread
From: Jan-Benedict Glaw @ 2023-06-23 21:08 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2378 bytes --]

Hi Tom!

Building with newer GCC versions (I'm doing CI builds with -Werror),
we might see warnings like this:

/usr/lib/gcc-snapshot/bin/g++  -fno-PIE -c   -g -O2   -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include  -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o nvptx.o -MT nvptx.o -MMD -MP -MF ./.deps/nvptx.TPo ../../gcc/gcc/config/nvptx/nvptx.cc
../../gcc/gcc/config/nvptx/nvptx.cc: In function 'void handle_ptx_version_option()':
../../gcc/gcc/config/nvptx/nvptx.cc:325:12: error: unquoted identifier or keyword 'sm_' in format [-Werror=format-diag]
  325 |     error ("PTX version (%<-mptx%>) needs to be at least %s to support selected"
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  326 |            " %<-misa%> (sm_%s)", ptx_version_to_string (first),
      |            ~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:2456: nvptx.o] Error 1


This is because the '_' triggers a generic heuristic that this is
probably something special. As I read the message, the `sm_*` ISA
descriptor belongs to `-misa`, so maybe just reposition the
quotation marks?


gcc/ChangeLog:
	* config/nvptx/nvptx.cc (handle_ptx_version_option):
	Reposition quotation marks around option with argument.



diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 49cc6814178..ffe6a438265 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -323,7 +323,7 @@ handle_ptx_version_option (void)
 
   if (ptx_version_option < first)
     error ("PTX version (%<-mptx%>) needs to be at least %s to support selected"
-	   " %<-misa%> (sm_%s)", ptx_version_to_string (first),
+	   " %<-misa sm_%s%>", ptx_version_to_string (first),
 	   sm_version_to_string ((enum ptx_isa)ptx_isa_option));
 }
 


Ok for trunk?

Thanks,
  Jan-Benedict

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-23 21:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23 21:08 GCC nvptx: Silence warning? Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).