[Mlir-commits] [mlir] 0fbe3f3 - [mlir][sparse] Fixes C++98 warning
wren romano
llvmlistbot at llvm.org
Fri May 27 13:42:24 PDT 2022
Author: wren romano
Date: 2022-05-27T13:42:17-07:00
New Revision: 0fbe3f3f486e01448121f7931a4ca29fac1504ab
URL: https://github.com/llvm/llvm-project/commit/0fbe3f3f486e01448121f7931a4ca29fac1504ab
DIFF: https://github.com/llvm/llvm-project/commit/0fbe3f3f486e01448121f7931a4ca29fac1504ab.diff
LOG: [mlir][sparse] Fixes C++98 warning
The semicolons were introduced in D126105 in order to correct clang-format, but I forgot this file must be compiled as C++98 rather than C++11.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D126561
Added:
Modified:
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
index ccc8c7a19387a..3a595fdb26e93 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
@@ -1551,14 +1551,17 @@ FOREVERY_O(IMPL_SPARSEINDICES)
FOREVERY_SIMPLEX_V(IMPL_ADDELT)
IMPL_ADDELT(C64, complex64)
// Marked static because it's not part of the public API.
-// (The `static` keyword confuses clang-format, so the extraneous trailing
-// semicolon is required to teach clang-format not to indent the prototype
-// of `_mlir_ciface_addEltC32` below.)
-static IMPL_ADDELT(C32ABI, complex32);
+// NOTE: the `static` keyword confuses clang-format here, causing
+// the strange indentation of the `_mlir_ciface_addEltC32` prototype.
+// In C++11 we can add a semicolon after the call to `IMPL_ADDELT`
+// and that will correct clang-format. Alas, this file is compiled
+// in C++98 mode where that semicolon is illegal (and there's no portable
+// macro magic to license a no-op semicolon at the top level).
+static IMPL_ADDELT(C32ABI, complex32)
#undef IMPL_ADDELT
-void *_mlir_ciface_addEltC32(void *coo, float r, float i,
- StridedMemRefType<index_type, 1> *iref,
- StridedMemRefType<index_type, 1> *pref) {
+ void *_mlir_ciface_addEltC32(void *coo, float r, float i,
+ StridedMemRefType<index_type, 1> *iref,
+ StridedMemRefType<index_type, 1> *pref) {
return _mlir_ciface_addEltC32ABI(coo, complex32(r, i), iref, pref);
}
@@ -1595,14 +1598,12 @@ FOREVERY_V(IMPL_GETNEXT)
FOREVERY_SIMPLEX_V(IMPL_LEXINSERT)
IMPL_LEXINSERT(C64, complex64)
// Marked static because it's not part of the public API.
-// (The `static` keyword confuses clang-format, so the extraneous trailing
-// semicolon is required to teach clang-format not to indent the prototype
-// of `_mlir_ciface_lexInsertC32` below.)
-static IMPL_LEXINSERT(C32ABI, complex32);
+// NOTE: see the note for `_mlir_ciface_addEltC32ABI`
+static IMPL_LEXINSERT(C32ABI, complex32)
#undef IMPL_LEXINSERT
-void _mlir_ciface_lexInsertC32(void *tensor,
- StridedMemRefType<index_type, 1> *cref, float r,
- float i) {
+ void _mlir_ciface_lexInsertC32(void *tensor,
+ StridedMemRefType<index_type, 1> *cref,
+ float r, float i) {
_mlir_ciface_lexInsertC32ABI(tensor, cref, complex32(r, i));
}
More information about the Mlir-commits
mailing list