[all-commits] [llvm/llvm-project] c63d4f: [mlir][sparse] Improving the FATAL macro

wren romano via All-commits all-commits at lists.llvm.org
Tue May 31 14:31:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c63d4fac4f2a726e1fe214dabbe574ef863fe896
      https://github.com/llvm/llvm-project/commit/c63d4fac4f2a726e1fe214dabbe574ef863fe896
  Author: wren romano <2998727+wrengr at users.noreply.github.com>
  Date:   2022-05-31 (Tue, 31 May 2022)

  Changed paths:
    M mlir/lib/ExecutionEngine/SparseTensorUtils.cpp

  Log Message:
  -----------
  [mlir][sparse] Improving the FATAL macro

The previous macro definition using `{...}` would fail to compile when the callsite uses a semicolon followed by an else-statement (i.e., `if (...) FATAL(...); else ...;`).  Replacing the simple braces with `do{...}while(0)` (n.b., semicolon not included in the macro definition) enables callsites to use the semicolon plus else-statement syntax without problems.  The new definition now requires the semicolon at all callsites, but since it was already being called that way nothing changes.

For more explanation, see <https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html>

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D126514




More information about the All-commits mailing list