[clang] [WebAssembly] Define __USING_WASM_EXCEPTIONS__ for -fwasm-exceptions (PR #92604)

Sam Clegg via cfe-commits cfe-commits at lists.llvm.org
Fri May 17 15:34:45 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__");
----------------
sbc100 wrote:

I see the `__USING_` prefix does predate out work on Wasm exceptions so there is some precedent.  

I see __USING_SJLJ_EXCEPTIONS__ dating all the way back to 2009: 2f5c75e17dc0b2df841db396de22c35b95cb7f41.   However, I don't see any other predefined macros using the `__USING_` prefix, so it might be worth removing it now before it gets even harder to remove.

Presumably it would be quite easy for downstream toolchains to switch to using `__WASM_EXCEPTIONS__` either before or after this change lands.. and then remove the manual define at some point in the future.

https://github.com/llvm/llvm-project/pull/92604


More information about the cfe-commits mailing list