[testsuite] : Avoid -Wformat warnings in guality.h

Message ID CAFULd4Z4x97i5Xo9=ZCOGuRCrL4g7Qi9qehjEKr4vC0DdyE3uw@mail.gmail.com
State New
Headers show
Series
  • [testsuite] : Avoid -Wformat warnings in guality.h
Related show

Commit Message

Uros Bizjak Dec. 17, 2017, 8:32 p.m.
The patch avoids following -Wformat warnings for 64bit targets:

guality.h: In function ‘guality_check’:
guality.h:366:19: warning: format ‘%lli’ expects argument of type
‘long long int’, but argument 4 has type ‘gualchk_t’ {aka ‘long int’}
[-Wformat=]
  fprintf (stderr, "PASS: " GUALITY_TEST ": %s is %lli\n", name, value);

2017-12-17  Uros Bizjak  <ubizjak@gmail.com>

    * gcc.dg/guality/guality.h (guality_check): Cast %lli arguments
    inf fprintf statements to long long int.

Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN.

Uros.

Patch

Index: gcc.dg/guality/guality.h
===================================================================
--- gcc.dg/guality/guality.h	(revision 255651)
+++ gcc.dg/guality/guality.h	(working copy)
@@ -363,15 +363,18 @@ 
     switch (result)
       {
       case PASS:
-	fprintf (stderr, "PASS: " GUALITY_TEST ": %s is %lli\n", name, value);
+	fprintf (stderr, "PASS: " GUALITY_TEST ": %s is %lli\n", name,
+		 (long long int) value);
 	break;
       case INCORRECT:
-	fprintf (stderr, "FAIL: " GUALITY_TEST ": %s is %lli, not %lli\n", name, xvalue, value);
+	fprintf (stderr, "FAIL: " GUALITY_TEST ": %s is %lli, not %lli\n", name,
+		 (long long int) xvalue, (long long int) value);
 	break;
       case INCOMPLETE:
 	fprintf (stderr, "%s: " GUALITY_TEST ": %s is %s, expected %lli\n",
 		 unknown_ok ? "UNRESOLVED" : "FAIL", name,
-		 unavailable < 0 ? "not computable" : "optimized away", value);
+		 unavailable < 0 ? "not computable" : "optimized away",
+		 (long long int) value);
 	result = unknown_ok ? INCOMPLETE : INCORRECT;
 	break;
       default: