[PATCH] D102791: [WebAssembly] Warn on exception spec for Emscripten EH

Heejin Ahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 20 01:10:31 PDT 2021


aheejin added a comment.

In D102791#2769892 <https://reviews.llvm.org/D102791#2769892>, @dschuff wrote:

> BTW Is there a way to disable this warning?

The warning is like

  test.cpp:3:6: warning: dynamic exception specifications with types are currently ignored in wasm [-Wwasm-exception-spec]

So `-Wno-wasm-exception-spec` will disable the warning.

> Since IIUC this could cause code that was not warning (because it used -fno-exceptions or used emscripten's default of -fignore-exceptions) to now start warning, sometimes that makes users who use -Werror unhappy.

`-fno-exceptions` does not print this warning. `-fignore-exceptions` does. There is a way to disable this as I said above, but if this makes existing users unhappy, I can abandon this patch. It was just to give users a hint that this feature they are using is in fact not working.



================
Comment at: clang/lib/CodeGen/CGException.cpp:495
+        CGM.getLangOpts().getExceptionHandling() ==
+            LangOptions::ExceptionHandlingKind::None &&
+        EST == EST_Dynamic)
----------------
dschuff wrote:
> Does emscripten's default of `-fignore-exceptions` also end up as haveing `ExceptionHandlingKind::None` even though exceptions aren't disabled?
Yes. This `ExceptionHandlingKind` has nothing to do with whether it is enabled or disabled. It is defined here: https://github.com/llvm/llvm-project/blob/a647100b4320923b0e9d156cc3872b3be470ad98/clang/include/clang/Basic/LangOptions.h#L233-L234

This is the clang counterpart to `-exception-model` in LLVM backend. If we don't use `-fwasm-exceptions`, `ExceptionHandlingKind` will be `None` whether Emscripten EH is enabled or not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102791/new/

https://reviews.llvm.org/D102791



More information about the cfe-commits mailing list