Mercurial > hg > CbC > CbC_llvm
diff flang/runtime/io-error.cpp @ 221:79ff65ed7e25
LLVM12 Original
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jun 2021 19:15:29 +0900 |
parents | 0572611fdcc8 |
children | 5f17cb93ff66 |
line wrap: on
line diff
--- a/flang/runtime/io-error.cpp Tue Jun 15 19:13:43 2021 +0900 +++ b/flang/runtime/io-error.cpp Tue Jun 15 19:15:29 2021 +0900 @@ -17,20 +17,13 @@ namespace Fortran::runtime::io { -void IoErrorHandler::Begin(const char *sourceFileName, int sourceLine) { - flags_ = 0; - ioStat_ = 0; - ioMsg_.reset(); - SetLocation(sourceFileName, sourceLine); -} - void IoErrorHandler::SignalError(int iostatOrErrno, const char *msg, ...) { if (iostatOrErrno == IostatEnd && (flags_ & hasEnd)) { - if (!ioStat_ || ioStat_ < IostatEnd) { + if (ioStat_ == IostatOk || ioStat_ < IostatEnd) { ioStat_ = IostatEnd; } } else if (iostatOrErrno == IostatEor && (flags_ & hasEor)) { - if (!ioStat_ || ioStat_ < IostatEor) { + if (ioStat_ == IostatOk || ioStat_ < IostatEor) { ioStat_ = IostatEor; // least priority } } else if (iostatOrErrno != IostatOk) { @@ -43,12 +36,14 @@ va_start(ap, msg); std::vsnprintf(buffer, sizeof buffer, msg, ap); ioMsg_ = SaveDefaultCharacter(buffer, std::strlen(buffer) + 1, *this); + va_end(ap); } } } else if (msg) { va_list ap; va_start(ap, msg); CrashArgs(msg, ap); + va_end(ap); } else if (const char *errstr{IostatErrorString(iostatOrErrno)}) { Crash(errstr); } else {