[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)
Heejin Ahn via cfe-commits
cfe-commits at lists.llvm.org
Fri May 17 14:44:02 PDT 2024
================
@@ -1006,6 +1006,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
else if (LangOpts.hasDWARFExceptions() &&
(TI.getTriple().isThumb() || TI.getTriple().isARM()))
Builder.defineMacro("__ARM_DWARF_EH__");
+ else if (LangOpts.hasWasmExceptions() && TI.getTriple().isWasm())
+ Builder.defineMacro("__USING_WASM_EXCEPTIONS__");
----------------
aheejin wrote:
I like it more too. I started using `__USING_WASM_EXCEPTIONS__` mostly because to be consistent with `__USING_SJLJ_EXCEPTIONS__`, which Wasm EH share many traits. There are many lines in libc++abi and libunwind where both SjLj and Wasm include or exclude by `ifdef`s like this
https://github.com/llvm/llvm-project/blob/bdfb04a63d73c31ee75395064762d0d6ccb45819/libcxxabi/src/cxa_personality.cpp#L645
Not sure if it was really necessary to be consistent with it though. But anyway to do that we need to fix it everywhere, both in LLVM and Emscripten and libraries (libc++abi and libunwind). And it is likely other toolchains (like WASI) users have been defining `__USING_WASM_EXCEPTIONS__` somewhere in their build system already given that we have not been defining this in Clang so far. Do you think it's worth changing or feasible?
https://github.com/llvm/llvm-project/pull/92604
More information about the cfe-commits
mailing list