[PATCH] D13054: [libc++] Un-guarded reference to uncaught_exception() in ostream header

Asiri Rathnayake via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 05:22:56 PDT 2015


rmaprath created this revision.
rmaprath added a subscriber: cfe-commits.

The ostream header contains an un-guarded reference to uncaught_exception() which causes it to drag in the exception handling machinery even when not required (i.e. when compiling with -fno-exceptions). There are no tests for this fix as the behaviour is only visible at link time (unnecessary symbols present and increased image size).

http://reviews.llvm.org/D13054

Files:
  include/ostream

Index: include/ostream
===================================================================
--- include/ostream
+++ include/ostream
@@ -260,7 +260,10 @@
 basic_ostream<_CharT, _Traits>::sentry::~sentry()
 {
     if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf)
-                      && !uncaught_exception())
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                      && !uncaught_exception()
+#endif  // _LIBCPP_NO_EXCEPTIONS
+       )
     {
 #ifndef _LIBCPP_NO_EXCEPTIONS
         try


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13054.35366.patch
Type: text/x-patch
Size: 507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150922/7da79931/attachment.bin>


More information about the cfe-commits mailing list