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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to