| 1 |
! Verify that reading from stdin works as expected - Fortran input |
| 2 |
|
| 3 |
!-------------------------- |
| 4 |
! FLANG DRIVER (flang) |
| 5 |
!-------------------------- |
| 6 |
! Input type is implicit |
| 7 |
! RUN: cat %s | %flang -E -cpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED |
| 8 |
! RUN: cat %s | %flang -DNEW -E -cpp - | FileCheck %s --check-prefix=PP-DEFINED |
| 9 |
! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-NOT-DEFINED |
| 10 |
! RUN: cat %s | %flang -DNEW -E -nocpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED |
| 11 |
|
| 12 |
! Input type is explicit |
| 13 |
! RUN: cat %s | %flang -E -cpp -x f95-cpp-input - | FileCheck %s --check-prefix=PP-NOT-DEFINED |
| 14 |
! RUN: cat %s | %flang -DNEW -E -cpp -x f95-cpp-input - | FileCheck %s --check-prefix=PP-DEFINED |
| 15 |
|
| 16 |
!--------------------------------------- |
| 17 |
! FLANG FRONTEND DRIVER (flang -fc1) |
| 18 |
!--------------------------------------- |
| 19 |
! Test `-E`: for the corresponding frontend actions the driver relies on the prescanner API to handle file I/O |
| 20 |
! RUN: cat %s | %flang_fc1 -E -cpp | FileCheck %s --check-prefix=PP-NOT-DEFINED |
| 21 |
! RUN: cat %s | %flang_fc1 -DNEW -E -cpp | FileCheck %s --check-prefix=PP-DEFINED |
| 22 |
|
| 23 |
! Test `-test-io`: for the corresponding frontend action (`InputOutputTestAction`) the driver handles the file I/O on its own |
| 24 |
! the corresponding action (`PrintPreprocessedAction`) |
| 25 |
! RUN: cat %s | %flang_fc1 -test-io -cpp | FileCheck %s --check-prefix=IO --match-full-lines |
| 26 |
! RUN: cat %s | %flang_fc1 -DNEW -cpp -test-io | FileCheck %s --check-prefix=IO --match-full-lines |
| 27 |
|
| 28 |
! PP-NOT-DEFINED: Program B |
| 29 |
! PP-DEFINED: Program A |
| 30 |
|
| 31 |
! IO: #ifdef NEW |
| 32 |
! IO-NEXT: Program A |
| 33 |
! IO-NEXT: #else |
| 34 |
! IO-NEXT: Program B |
| 35 |
! IO-NEXT: #endif |
| 36 |
|
| 37 |
#ifdef NEW |
| 38 |
Program A |
| 39 |
#else |
| 40 |
Program B |
| 41 |
#endif |