[mlir][sparse] Fixes C++98 warning
authorwren romano <2998727+wrengr@users.noreply.github.com>
Fri, 27 May 2022 19:42:46 +0000 (12:42 -0700)
committerwren romano <2998727+wrengr@users.noreply.github.com>
Fri, 27 May 2022 20:42:17 +0000 (13:42 -0700)
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

mlir/lib/ExecutionEngine/SparseTensorUtils.cpp

index ccc8c7a..3a595fd 100644 (file)
@@ -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));
 }