Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled.  Reviewed as: https://reviews.llvm.org/D23855.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279744 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/fstream b/include/fstream
index 3cb3b13..ce13b31 100644
--- a/include/fstream
+++ b/include/fstream
@@ -618,10 +618,9 @@
             size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
             if (__nr != 0)
             {
-#ifndef _LIBCPP_NO_EXCEPTIONS
                 if (!__cv_)
-                    throw bad_cast();
-#endif
+                    __throw_bad_cast();
+
                 __extbufend_ = __extbufnext_ + __nr;
                 char_type*  __inext;
                 __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
@@ -700,10 +699,9 @@
             codecvt_base::result __r;
             do
             {
-#ifndef _LIBCPP_NO_EXCEPTIONS
                 if (!__cv_)
-                    throw bad_cast();
-#endif
+                    __throw_bad_cast();
+
                 const char_type* __e;
                 __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
                                         __extbuf_, __extbuf_ + __ebs_, __extbe);
@@ -793,10 +791,9 @@
 basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
                                         ios_base::openmode)
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
     if (!__cv_)
-        throw bad_cast();
-#endif
+        __throw_bad_cast();
+
     int __width = __cv_->encoding();
     if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
         return pos_type(off_type(-1));
@@ -852,10 +849,9 @@
 {
     if (__file_ == 0)
         return 0;
-#ifndef _LIBCPP_NO_EXCEPTIONS
     if (!__cv_)
-        throw bad_cast();
-#endif
+        __throw_bad_cast();
+
     if (__cm_ & ios_base::out)
     {
         if (this->pptr() != this->pbase())