diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2016-08-25 15:09:01 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2016-08-25 15:09:01 +0000 |
commit | d437fa5c8c1185af695b87cdd5ea83aa4a6e7382 (patch) | |
tree | 2fc9b60f206ef14e242a52af06f8f95b95693962 /libcxx/include/fstream | |
parent | b41b990e05797d1d69ea735bb168893974757422 (diff) | |
download | bcm5719-llvm-d437fa5c8c1185af695b87cdd5ea83aa4a6e7382.tar.gz bcm5719-llvm-d437fa5c8c1185af695b87cdd5ea83aa4a6e7382.zip |
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.
llvm-svn: 279744
Diffstat (limited to 'libcxx/include/fstream')
-rw-r--r-- | libcxx/include/fstream | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libcxx/include/fstream b/libcxx/include/fstream index 3cb3b13bd10..ce13b31c87f 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -618,10 +618,9 @@ basic_filebuf<_CharT, _Traits>::underflow() 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 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) 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 @@ typename basic_filebuf<_CharT, _Traits>::pos_type 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 @@ basic_filebuf<_CharT, _Traits>::sync() { 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()) |