Skip to content

Commit dfc8459

Browse files
RichBarton-Armzmodem
authored andcommitted
[flang] Make interactive behaviour more obvious
When flang is invoked with no files it waits for input on stdin. Make it print a message saying this to prevent the user being surprised. Differential Revision: https://reviews.llvm.org/D84855 (cherry picked from commit dd5ea56)
1 parent 556e65b commit dfc8459

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

flang/test/Driver/Inputs/hello.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
program hello
2+
write (*,*), "hello world"
3+
end program hello

flang/test/Driver/no_files.f90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
! RUN: %f18 < %S/Inputs/hello.f90 | FileCheck %s
2+
3+
4+
! CHECK: Enter Fortran source
5+
! CHECK: Use EOF character (^D) to end file
6+
7+
! CHECK: Parse tree comprises {{.*}} objects and occupies {{.*}} total bytes
8+
! CHECK: PROGRAM hello
9+
! CHECK: WRITE (*, *) "hello world"
10+
! CHECK: END PROGRAM hello

flang/tools/f18/f18.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,8 @@ int main(int argc, char *const argv[]) {
683683
if (!anyFiles) {
684684
driver.measureTree = true;
685685
driver.dumpUnparse = true;
686+
llvm::outs() << "Enter Fortran source\n"
687+
<< "Use EOF character (^D) to end file\n";
686688
CompileFortran("-", options, driver, defaultKinds);
687689
return exitStatus;
688690
}

0 commit comments

Comments
 (0)