[Mlir-commits] [mlir] 87ff65b - [mlir][test] Fix -Wformat in sparse_tensor.c (NFC)

Jie Fu llvmlistbot at llvm.org
Mon Feb 5 18:50:42 PST 2024


Author: Jie Fu
Date: 2024-02-06T10:50:34+08:00
New Revision: 87ff65b07c82337d99b0dc0ca562e394ecedc11b

URL: https://github.com/llvm/llvm-project/commit/87ff65b07c82337d99b0dc0ca562e394ecedc11b
DIFF: https://github.com/llvm/llvm-project/commit/87ff65b07c82337d99b0dc0ca562e394ecedc11b.diff

LOG: [mlir][test] Fix -Wformat in sparse_tensor.c (NFC)

llvm-project/mlir/test/CAPI/sparse_tensor.c:50:43:
error: format specifies type 'unsigned long long' but the argument has type 'MlirSparseTensorLevelType' (aka 'unsigned long') [-Werror,-Wformat]
    fprintf(stderr, "level_type: %llu\n", lvlTypes[l]);
                                 ~~~~     ^~~~~~~~~~~
                                 %lu
1 error generated.

Added: 
    

Modified: 
    mlir/test/CAPI/sparse_tensor.c

Removed: 
    


################################################################################
diff  --git a/mlir/test/CAPI/sparse_tensor.c b/mlir/test/CAPI/sparse_tensor.c
index f5d43a2eccdc0..2c6ad559f19d0 100644
--- a/mlir/test/CAPI/sparse_tensor.c
+++ b/mlir/test/CAPI/sparse_tensor.c
@@ -14,6 +14,7 @@
 #include "mlir-c/RegisterEverything.h"
 
 #include <assert.h>
+#include <inttypes.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -47,7 +48,7 @@ static int testRoundtripEncoding(MlirContext ctx) {
       malloc(sizeof(MlirSparseTensorLevelType) * lvlRank);
   for (int l = 0; l < lvlRank; ++l) {
     lvlTypes[l] = mlirSparseTensorEncodingAttrGetLvlType(originalAttr, l);
-    fprintf(stderr, "level_type: %llu\n", lvlTypes[l]);
+    fprintf(stderr, "level_type: %" PRIu64 "\n", lvlTypes[l]);
   }
   // CHECK: posWidth: 32
   int posWidth = mlirSparseTensorEncodingAttrGetPosWidth(originalAttr);


        


More information about the Mlir-commits mailing list