llvm-project/flang/test/Driver/driver-version.f90
Emil Kieri 577827cbbf [flang][driver] Make --version and -version consistent with clang
This patch makes -version valid, and --version invalid, for
flang-new -fc1. The invocation
  flang-new --version
remains valid. This behaviour is consistent with clang
(and with clang -cc1 and clang -cc1as).

Previously, flang-new -fc1 accepted --version (as per Options.td), but
the frontend driver acutally checks for -version. As a result,
  flang-new -fc1 --version
triggered no action, emitted no message, and stalled waiting for
standard input.

Fixes #51438

Reviewed By: PeteSteinfeld, awarzynski

Differential Revision: https://reviews.llvm.org/D122542
2022-03-28 22:53:17 +02:00

23 lines
701 B
Fortran

!-----------
! RUN LINES
!-----------
! RUN: %flang --version 2>&1 | FileCheck %s --check-prefix=VERSION
! RUN: not %flang --versions 2>&1 | FileCheck %s --check-prefix=ERROR
! RUN: %flang_fc1 -version 2>&1 | FileCheck %s --check-prefix=VERSION-FC1
! RUN: not %flang_fc1 --version 2>&1 | FileCheck %s --check-prefix=ERROR-FC1
!-----------------------
! EXPECTED OUTPUT
!-----------------------
! VERSION: flang-new version
! VERSION-NEXT: Target:
! VERSION-NEXT: Thread model:
! VERSION-NEXT: InstalledDir:
! ERROR: flang-new: error: unsupported option '--versions'; did you mean '--version'?
! VERSION-FC1: LLVM version
! ERROR-FC1: error: unknown argument '--version'; did you mean '-version'?