public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] Fix ptx warning
@ 2015-08-03 14:40 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2015-08-03 14:40 UTC (permalink / raw)
  To: GCC Patches

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

I've committed this to gomp4.  I  was reusing a size_t variable in a loop where 
unsigned would do, and fprintf got upset.

nathan

[-- Attachment #2: gomp4-ptx-fmt.patch --]
[-- Type: text/x-patch, Size: 1281 bytes --]

2015-08-03  Nathan Sidwell  <nathan@codesourcery.com>

	* config/nvptx/mkoffload.c (process): Avoid printf formatting
	warning.

Index: config/nvptx/mkoffload.c
===================================================================
--- config/nvptx/mkoffload.c	(revision 226504)
+++ config/nvptx/mkoffload.c	(working copy)
@@ -225,16 +225,16 @@ access_check (const char *name, int mode
 static void
 process (FILE *in, FILE *out)
 {
-  size_t len;
+  size_t len = 0;
   const char *input = read_file (in, &len);
   const char *comma;
   id_map const *id;
   unsigned obj_count = 0;
-  size_t i;
+  unsigned ix;
 
   /* Dump out char arrays for each PTX object file.  These are
      terminated by a NUL.  */
-  for (i = 0; i != len;)
+  for (size_t i = 0; i != len;)
     {
       char c;
       
@@ -280,8 +280,8 @@ process (FILE *in, FILE *out)
 	   "  const char *code;\n"
 	   "  __SIZE_TYPE__ size;\n"
 	   "} ptx_objs[] = {");
-  for (comma = "", i = 0; i != obj_count; comma = ",", i++)
-    fprintf (out, "%s\n\t{ptx_code_%u, sizeof (ptx_code_%u)}", comma, i, i);
+  for (comma = "", ix = 0; ix != obj_count; comma = ",", ix++)
+    fprintf (out, "%s\n\t{ptx_code_%u, sizeof (ptx_code_%u)}", comma, ix, ix);
   fprintf (out, "\n};\n\n");
 
   /* Dump out variable idents.  */

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

only message in thread, other threads:[~2015-08-03 14:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 14:40 [gomp4] Fix ptx warning Nathan Sidwell

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).