Skip to content

Commit

Permalink
[flang] Make interactive behaviour more obvious
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
RichBarton-Arm authored and zmodem committed Aug 18, 2020
1 parent 556e65b commit dfc8459
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions flang/test/Driver/Inputs/hello.f90
@@ -0,0 +1,3 @@
program hello
write (*,*), "hello world"
end program hello
10 changes: 10 additions & 0 deletions flang/test/Driver/no_files.f90
@@ -0,0 +1,10 @@
! RUN: %f18 < %S/Inputs/hello.f90 | FileCheck %s


! CHECK: Enter Fortran source
! CHECK: Use EOF character (^D) to end file

! CHECK: Parse tree comprises {{.*}} objects and occupies {{.*}} total bytes
! CHECK: PROGRAM hello
! CHECK: WRITE (*, *) "hello world"
! CHECK: END PROGRAM hello
2 changes: 2 additions & 0 deletions flang/tools/f18/f18.cpp
Expand Up @@ -683,6 +683,8 @@ int main(int argc, char *const argv[]) {
if (!anyFiles) {
driver.measureTree = true;
driver.dumpUnparse = true;
llvm::outs() << "Enter Fortran source\n"
<< "Use EOF character (^D) to end file\n";
CompileFortran("-", options, driver, defaultKinds);
return exitStatus;
}
Expand Down

0 comments on commit dfc8459

Please sign in to comment.