File tree 3 files changed +19
-2
lines changed
3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,17 @@ void ExecutionEnvironment::Configure(
67
67
}
68
68
}
69
69
70
+ if (auto *x{std::getenv (" NO_STOP_MESSAGE" )}) {
71
+ char *end;
72
+ auto n{std::strtol (x, &end, 10 )};
73
+ if (n >= 0 && n <= 1 && *end == ' \0 ' ) {
74
+ noStopMessage = n != 0 ;
75
+ } else {
76
+ std::fprintf (stderr,
77
+ " Fortran runtime: NO_STOP_MESSAGE=%s is invalid; ignored\n " , x);
78
+ }
79
+ }
80
+
70
81
// TODO: Set RP/ROUND='PROCESSOR_DEFINED' from environment
71
82
}
72
83
Original file line number Diff line number Diff line change @@ -37,9 +37,11 @@ struct ExecutionEnvironment {
37
37
int argc;
38
38
const char **argv;
39
39
const char **envp;
40
- int listDirectedOutputLineLengthLimit;
40
+
41
+ int listDirectedOutputLineLengthLimit; // FORT_FMT_RECL
41
42
enum decimal::FortranRounding defaultOutputRoundingMode;
42
- Convert conversion;
43
+ Convert conversion; // FORT_CONVERT
44
+ bool noStopMessage; // NO_STOP_MESSAGE=1 inhibits "Fortran STOP"
43
45
};
44
46
extern ExecutionEnvironment executionEnvironment;
45
47
} // namespace Fortran::runtime
Original file line number Diff line number Diff line change 7
7
// ===----------------------------------------------------------------------===//
8
8
9
9
#include " flang/Runtime/stop.h"
10
+ #include " environment.h"
10
11
#include " file.h"
11
12
#include " io-error.h"
12
13
#include " terminator.h"
@@ -52,6 +53,9 @@ static void CloseAllExternalUnits(const char *why) {
52
53
[[noreturn]] void RTNAME (StopStatement)(
53
54
int code, bool isErrorStop, bool quiet) {
54
55
CloseAllExternalUnits (" STOP statement" );
56
+ if (Fortran::runtime::executionEnvironment.noStopMessage && code == 0 ) {
57
+ quiet = true ;
58
+ }
55
59
if (!quiet) {
56
60
std::fprintf (stderr, " Fortran %s" , isErrorStop ? " ERROR STOP" : " STOP" );
57
61
if (code != EXIT_SUCCESS) {
You can’t perform that action at this time.
0 commit comments