[flang] Define new runtime error IOSTAT values (I/O runtime work part 4)
authorpeter klausler <pklausler@nvidia.com>
Fri, 3 Jul 2020 17:47:02 +0000 (10:47 -0700)
committerpeter klausler <pklausler@nvidia.com>
Fri, 3 Jul 2020 19:41:33 +0000 (12:41 -0700)
Add more IOSTAT= values for errors that can arise in external I/O.

Reviewed By: sscalpone

Differential Revision: https://reviews.llvm.org/D83140

flang/runtime/iostat.cpp
flang/runtime/iostat.h

index c86619d..9fe6d22 100644 (file)
@@ -33,6 +33,26 @@ const char *IostatErrorString(int iostat) {
     return "Invalid FORMAT";
   case IostatErrorInKeyword:
     return "Bad keyword argument value";
+  case IostatEndfileNonSequential:
+    return "ENDFILE on non-sequential file";
+  case IostatEndfileUnwritable:
+    return "ENDFILE on read-only file";
+  case IostatOpenBadRecl:
+    return "OPEN with bad RECL= value";
+  case IostatOpenUnknownSize:
+    return "OPEN of file of unknown size";
+  case IostatOpenBadAppend:
+    return "OPEN(POSITION='APPEND') of unpositionable file";
+  case IostatWriteToReadOnly:
+    return "Attempted output to read-only file";
+  case IostatReadFromWriteOnly:
+    return "Attempted input from write-only file";
+  case IostatBackspaceNonSequential:
+    return "BACKSPACE on non-sequential file";
+  case IostatBackspaceAtFirstRecord:
+    return "BACKSPACE at first record";
+  case IostatRewindNonSequential:
+    return "REWIND on non-sequential file";
   default:
     return nullptr;
   }
index 2ab5ac8..f51636d 100644 (file)
@@ -45,6 +45,16 @@ enum Iostat {
   IostatInternalWriteOverrun,
   IostatErrorInFormat,
   IostatErrorInKeyword,
+  IostatEndfileNonSequential,
+  IostatEndfileUnwritable,
+  IostatOpenBadRecl,
+  IostatOpenUnknownSize,
+  IostatOpenBadAppend,
+  IostatWriteToReadOnly,
+  IostatReadFromWriteOnly,
+  IostatBackspaceNonSequential,
+  IostatBackspaceAtFirstRecord,
+  IostatRewindNonSequential,
 };
 
 const char *IostatErrorString(int);