]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] H8/300: PR target/109189 Silence -Wformat warnings on Windows
authorJan Dubiec <jdx@o2.pl>
Sat, 1 Mar 2025 05:01:42 +0000 (22:01 -0700)
committerJeff Law <jlaw@ventanamicro.com>
Sat, 1 Mar 2025 05:02:59 +0000 (22:02 -0700)
This patch fixes annoying -Wformat warnings when gcc is built
on Windows/MinGW64. Instead of %ld it uses HOST_WIDE_INT_PRINT_DEC
macro, just like many other targets do.

PR target/109189
gcc/ChangeLog:

* config/h8300/h8300.cc (h8300_print_operand): Replace %ld format
strings with HOST_WIDE_INT_PRINT_DEC macro in order to silence
-Wformat warnings when building on Windows/MinGW64.

gcc/config/h8300/h8300.cc

index 00135e8d02dc60f98bcd4d7b3ff1571e5d11016f..02056d0ff19f89b3f7ed504c558b5cd6eb69104f 100644 (file)
@@ -1444,7 +1444,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
          fprintf (file, "%sl", names_big[REGNO (x)]);
          break;
        case CONST_INT:
-         fprintf (file, "#%ld", (-INTVAL (x)) & 0xff);
+         fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, (-INTVAL (x)) & 0xff);
          break;
        default:
          gcc_unreachable ();
@@ -1457,7 +1457,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
          fprintf (file, "%sh", names_big[REGNO (x)]);
          break;
        case CONST_INT:
-         fprintf (file, "#%ld", ((-INTVAL (x)) & 0xff00) >> 8);
+         fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, ((-INTVAL (x)) & 0xff00) >> 8);
          break;
        default:
          gcc_unreachable ();
@@ -1465,7 +1465,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
       break;
     case 'G':
       gcc_assert (GET_CODE (x) == CONST_INT);
-      fprintf (file, "#%ld", 0xff & (-INTVAL (x)));
+      fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, 0xff & (-INTVAL (x)));
       break;
     case 'S':
       if (GET_CODE (x) == REG)
@@ -1542,7 +1542,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
          h8300_print_operand (file, x, 0);
          break;
        case CONST_INT:
-         fprintf (file, "#%ld", ((INTVAL (x) >> 16) & 0xffff));
+         fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, ((INTVAL (x) >> 16) & 0xffff));
          break;
        case CONST_DOUBLE:
          {
@@ -1567,7 +1567,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
          h8300_print_operand (file, x, 0);
          break;
        case CONST_INT:
-         fprintf (file, "#%ld", INTVAL (x) & 0xffff);
+         fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, INTVAL (x) & 0xffff);
          break;
        case CONST_DOUBLE:
          {
@@ -1621,7 +1621,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
       break;
     case 's':
       if (GET_CODE (x) == CONST_INT)
-       fprintf (file, "#%ld", (INTVAL (x)) & 0xff);
+       fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, (INTVAL (x)) & 0xff);
       else if (GET_CODE (x) == REG)
        fprintf (file, "%s", byte_reg (x, 0));
       else
@@ -1629,7 +1629,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
       break;
     case 't':
       if (GET_CODE (x) == CONST_INT)
-       fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff);
+       fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, (INTVAL (x) >> 8) & 0xff);
       else if (GET_CODE (x) == REG)
        fprintf (file, "%s", byte_reg (x, 1));
       else
@@ -1637,7 +1637,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
       break;
     case 'w':
       if (GET_CODE (x) == CONST_INT)
-       fprintf (file, "#%ld", INTVAL (x) & 0xff);
+       fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, INTVAL (x) & 0xff);
       else if (GET_CODE (x) == REG)
        fprintf (file, "%s", byte_reg (x, 0));
       else
@@ -1645,7 +1645,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
       break;
     case 'x':
       if (GET_CODE (x) == CONST_INT)
-       fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff);
+       fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, (INTVAL (x) >> 8) & 0xff);
       else if (GET_CODE (x) == REG)
        fprintf (file, "%s", byte_reg (x, 1));
       else
@@ -1653,7 +1653,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
       break;
     case 'y':
       if (GET_CODE (x) == CONST_INT)
-       fprintf (file, "#%ld", (INTVAL (x) >> 16) & 0xff);
+       fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, (INTVAL (x) >> 16) & 0xff);
       else if (GET_CODE (x) == REG)
        fprintf (file, "%s", byte_reg (x, 0));
       else
@@ -1661,7 +1661,7 @@ h8300_print_operand (FILE *file, rtx x, int code)
       break;
     case 'z':
       if (GET_CODE (x) == CONST_INT)
-       fprintf (file, "#%ld", (INTVAL (x) >> 24) & 0xff);
+       fprintf (file, "#" HOST_WIDE_INT_PRINT_DEC, (INTVAL (x) >> 24) & 0xff);
       else if (GET_CODE (x) == REG)
        fprintf (file, "%s", byte_reg (x, 1));
       else