This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix warnings about printf format


"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:

>  > Bootstrapped on 3.4 but now I get this warning:
>  > c-parse.y:3096: warning: traditional C rejects string concatenation
>  > 
>  > So, what's the proper way to do this?  Shall I print the space
>  > separatly with an fputs?
>  > Andreas
>
> Yes, thanks.

OK, here's an updated patch.  I'm bootstrapping/regtesting it now.  Ok
to commit if it passes?

Andreas

2002-12-27  Andreas Jaeger  <aj@suse.de>

	* c-parse.in (yyprint): Use HOST_WIDE_INT_PRINT_DOUBLE_HEX for
	correct format.
============================================================
Index: gcc/c-parse.in
--- gcc/c-parse.in	16 Dec 2002 18:19:02 -0000	1.153
+++ gcc/c-parse.in	27 Dec 2002 19:02:29 -0000
@@ -3891,25 +3891,11 @@ yyprint (file, yychar, yyl)
     case CONSTANT:
       fprintf (file, " %s", GET_MODE_NAME (TYPE_MODE (TREE_TYPE (t))));
       if (TREE_CODE (t) == INTEGER_CST)
-	fprintf (file,
-#if HOST_BITS_PER_WIDE_INT == 64
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
-		 " 0x%x%016x",
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
-		 " 0x%lx%016lx",
-#else
-		 " 0x%llx%016llx",
-#endif
-#endif
-#else
-#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
-		 " 0x%lx%08lx",
-#else
-		 " 0x%x%08x",
-#endif
-#endif
-		 TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
+	{
+	  fputs (" ", file);
+	  fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+		   TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
+	}
       break;
     }
 }

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]