Skip to content

Commit 2d3d62d

Browse files
[flang] fix: split ifndef for CHECK and CHECK_MSG (#114707)
Resolves #114703 I think it's the best practice that each macro has it's own `ifndef` check and this way the build issue is resolved for me. I also find the names of these macro a bit too generic - an easy recipe for conflicts. In my case, the error was likely caused by something else defining `CHECK` but not `CHECK_MSG`, so likely these `CHECK` and `CHECK_MSG` weren't actually working at all because the result of `ifndef` is always false. As a definitive fix, perhaps it makes sense to rename them to something more specific, e.g. `FLANG_CHECK` and `FLANG_CHECK_MSG`.
1 parent 74496b0 commit 2d3d62d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

flang/include/flang/Common/idioms.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ template <typename... LAMBDAS> visitors(LAMBDAS... x) -> visitors<LAMBDAS...>;
8787
// To disable, compile with '-DCHECK=(void)'
8888
#ifndef CHECK
8989
#define CHECK(x) ((x) || (DIE("CHECK(" #x ") failed"), false))
90+
#endif
91+
9092
// Same as above, but with a custom error message.
93+
#ifndef CHECK_MSG
9194
#define CHECK_MSG(x, y) ((x) || (DIE("CHECK(" #x ") failed: " #y), false))
9295
#endif
9396

0 commit comments

Comments
 (0)