[libcxx-commits] [libcxx] [libc++] Guard ..._REMOVED_UNCAUGHT_EXCEPTION behind ifndef (PR #106719)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 30 06:14:15 PDT 2024


================
@@ -6,7 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION
+#ifndef _LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION
+#  define _LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION
+#endif
----------------
ldionne wrote:

Right, I was somewhat expecting a less mainstream setup, since this shouldn't be possible if you use the normal ways to build libc++.

Libc++ does not expect to be built just like any other "user" project. It may not be safe to pass arbitrary flags you're passing when you compile user code. It's not that there's something fundamentally wrong with `_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION` specifically, but the code as written had the intended effect: it caught when you compiled it in a way that was unexpected. That's why I'm pushing back against this simple change: it turns something that should be caught into a silent pass, hiding the fact that your build setup is not as it should.

I don't know much about Bazel but it looks like you should make sure to isolate what flags you're passing when building projects, at least libc++.

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


More information about the libcxx-commits mailing list