[Mlir-commits] [mlir] 998f3e7 - [mlir] Fix -Wcast-qual in mlir/test/CAPI/ir.c after D153911 (NFC)
Jie Fu
llvmlistbot at llvm.org
Tue Jul 18 20:18:09 PDT 2023
Author: Jie Fu
Date: 2023-07-19T11:16:55+08:00
New Revision: 998f3e71c8e98cd6c3d6110fb7ca6e1700592e75
URL: https://github.com/llvm/llvm-project/commit/998f3e71c8e98cd6c3d6110fb7ca6e1700592e75
DIFF: https://github.com/llvm/llvm-project/commit/998f3e71c8e98cd6c3d6110fb7ca6e1700592e75.diff
LOG: [mlir] Fix -Wcast-qual in mlir/test/CAPI/ir.c after D153911 (NFC)
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1120:18: error: cast from 'const void *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
(uint8_t *)mlirDenseElementsAttrGetRawData(uint8Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1121:35: error: cast from 'const void *' to 'signed char *' drops const qualifier [-Werror,-Wcast-qual]
int8_t *int8RawData = (int8_t *)mlirDenseElementsAttrGetRawData(int8Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1123:19: error: cast from 'const void *' to 'unsigned int *' drops const qualifier [-Werror,-Wcast-qual]
(uint32_t *)mlirDenseElementsAttrGetRawData(uint32Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1125:18: error: cast from 'const void *' to 'int *' drops const qualifier [-Werror,-Wcast-qual]
(int32_t *)mlirDenseElementsAttrGetRawData(int32Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1127:19: error: cast from 'const void *' to 'unsigned long long *' drops const qualifier [-Werror,-Wcast-qual]
(uint64_t *)mlirDenseElementsAttrGetRawData(uint64Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1129:18: error: cast from 'const void *' to 'long long *' drops const qualifier [-Werror,-Wcast-qual]
(int64_t *)mlirDenseElementsAttrGetRawData(int64Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1130:34: error: cast from 'const void *' to 'float *' drops const qualifier [-Werror,-Wcast-qual]
float *floatRawData = (float *)mlirDenseElementsAttrGetRawData(floatElements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1132:17: error: cast from 'const void *' to 'double *' drops const qualifier [-Werror,-Wcast-qual]
(double *)mlirDenseElementsAttrGetRawData(doubleElements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1134:19: error: cast from 'const void *' to 'unsigned short *' drops const qualifier [-Werror,-Wcast-qual]
(uint16_t *)mlirDenseElementsAttrGetRawData(bf16Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1136:19: error: cast from 'const void *' to 'unsigned short *' drops const qualifier [-Werror,-Wcast-qual]
(uint16_t *)mlirDenseElementsAttrGetRawData(f16Elements);
^
10 errors generated.
Added:
Modified:
mlir/test/CAPI/ir.c
Removed:
################################################################################
diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c
index d388fcc45e31e1..c3b78fe1762c00 100644
--- a/mlir/test/CAPI/ir.c
+++ b/mlir/test/CAPI/ir.c
@@ -1116,24 +1116,24 @@ int printBuiltinAttributes(MlirContext ctx) {
fabs(mlirDenseElementsAttrGetDoubleSplatValue(splatDouble) - 1.0) > 1E-6)
return 17;
- uint8_t *uint8RawData =
- (uint8_t *)mlirDenseElementsAttrGetRawData(uint8Elements);
- int8_t *int8RawData = (int8_t *)mlirDenseElementsAttrGetRawData(int8Elements);
- uint32_t *uint32RawData =
- (uint32_t *)mlirDenseElementsAttrGetRawData(uint32Elements);
- int32_t *int32RawData =
- (int32_t *)mlirDenseElementsAttrGetRawData(int32Elements);
- uint64_t *uint64RawData =
- (uint64_t *)mlirDenseElementsAttrGetRawData(uint64Elements);
- int64_t *int64RawData =
- (int64_t *)mlirDenseElementsAttrGetRawData(int64Elements);
- float *floatRawData = (float *)mlirDenseElementsAttrGetRawData(floatElements);
- double *doubleRawData =
- (double *)mlirDenseElementsAttrGetRawData(doubleElements);
- uint16_t *bf16RawData =
- (uint16_t *)mlirDenseElementsAttrGetRawData(bf16Elements);
- uint16_t *f16RawData =
- (uint16_t *)mlirDenseElementsAttrGetRawData(f16Elements);
+ const uint8_t *uint8RawData =
+ (const uint8_t *)mlirDenseElementsAttrGetRawData(uint8Elements);
+ const int8_t *int8RawData = (const int8_t *)mlirDenseElementsAttrGetRawData(int8Elements);
+ const uint32_t *uint32RawData =
+ (const uint32_t *)mlirDenseElementsAttrGetRawData(uint32Elements);
+ const int32_t *int32RawData =
+ (const int32_t *)mlirDenseElementsAttrGetRawData(int32Elements);
+ const uint64_t *uint64RawData =
+ (const uint64_t *)mlirDenseElementsAttrGetRawData(uint64Elements);
+ const int64_t *int64RawData =
+ (const int64_t *)mlirDenseElementsAttrGetRawData(int64Elements);
+ const float *floatRawData = (const float *)mlirDenseElementsAttrGetRawData(floatElements);
+ const double *doubleRawData =
+ (const double *)mlirDenseElementsAttrGetRawData(doubleElements);
+ const uint16_t *bf16RawData =
+ (const uint16_t *)mlirDenseElementsAttrGetRawData(bf16Elements);
+ const uint16_t *f16RawData =
+ (const uint16_t *)mlirDenseElementsAttrGetRawData(f16Elements);
if (uint8RawData[0] != 0u || uint8RawData[1] != 1u || int8RawData[0] != 0 ||
int8RawData[1] != 1 || uint32RawData[0] != 0u || uint32RawData[1] != 1u ||
int32RawData[0] != 0 || int32RawData[1] != 1 || uint64RawData[0] != 0u ||
More information about the Mlir-commits
mailing list