diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp --- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp +++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp @@ -83,10 +83,10 @@ // to track down whether an error is coming from our code vs somewhere else // in MLIR.) #define FATAL(...) \ - { \ + do { \ fprintf(stderr, "SparseTensorUtils: " __VA_ARGS__); \ exit(1); \ - } + } while (0) // TODO: adjust this so it can be used by `openSparseTensorCOO` too. // That version doesn't have the permutation, and the `dimSizes` are @@ -1174,13 +1174,12 @@ uint64_t idata[512]; bool isPattern = false; bool isSymmetric = false; - if (strstr(filename, ".mtx")) { + if (strstr(filename, ".mtx")) readMMEHeader(file, filename, line, idata, &isPattern, &isSymmetric); - } else if (strstr(filename, ".tns")) { + else if (strstr(filename, ".tns")) readExtFROSTTHeader(file, filename, line, idata); - } else { + else FATAL("Unknown format %s\n", filename); - } // Prepare sparse tensor object with per-dimension sizes // and the number of nonzeros as initial capacity. assert(rank == idata[0] && "rank mismatch");