| 1 |
! Verify that the driver correctly processes `-fsyntax-only`. |
| 2 |
! |
| 3 |
! By default, the compiler driver (`flang`) will create actions/phases to |
| 4 |
! generate machine code (i.e. object files). The `-fsyntax-only` flag is a |
| 5 |
! "phase-control" flag that controls this behavior and makes the driver stop |
| 6 |
! once the semantic checks have been run. The frontend driver (`flang -fc1`) |
| 7 |
! runs `-fsyntax-only` by default (i.e. that's the default action), so the flag |
| 8 |
! can be skipped. |
| 9 |
|
| 10 |
! RUN: %flang -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty |
| 11 |
! RUN: %flang_fc1 %s 2>&1 | FileCheck %s --allow-empty |
| 12 |
|
| 13 |
! RUN: rm -rf %t/non-existent-dir/ |
| 14 |
! RUN: not %flang -c %s -o %t/non-existent-dir/syntax-only.o 2>&1 | FileCheck %s --check-prefix=NO_FSYNTAX_ONLY |
| 15 |
! RUN: not %flang_fc1 -emit-obj %s -o %t/non-existent-dir/syntax-only.o 2>&1 | FileCheck %s --check-prefix=NO_FSYNTAX_ONLY |
| 16 |
|
| 17 |
! CHECK-NOT: error |
| 18 |
! NO_FSYNTAX_ONLY: error: failed to create the output file |
| 19 |
|
| 20 |
end program |