[flang] Add -fsyntax-only to f18; retain -fparse-only synonym

Now that semantics is working, the standard -fsyntax-only option of
GNU and Clang should be used as the name of the option that causes
f18 to just run the front-end.  Support both options in f18, silently
accepting the old option as a synonym for the new one (as
preferred by the code owner), and replace all instances of the
old -fparse-only option with -fsyntax-only throughout the source base.

Differential Revision: https://reviews.llvm.org/D95887
This commit is contained in:
peter klausler 2021-02-02 10:51:14 -08:00
parent 81b69879c9
commit 34eb0adaa9
44 changed files with 67 additions and 67 deletions

View file

@ -67,7 +67,7 @@ of the call to `intentOutFunc()`:
I also used this program to produce a parse tree for the program using the command:
```bash
f18 -fdebug-dump-parse-tree -fparse-only testfun.f90
f18 -fdebug-dump-parse-tree -fsyntax-only testfun.f90
```
Here's the relevant fragment of the parse tree produced by the compiler:

View file

@ -46,7 +46,7 @@ See: [Preprocessing.md](Preprocessing.md).
**Entry point:** `parser::Parsing::Parse`
**Command:**
- `f18 -fdebug-dump-parse-tree -fparse-only src.f90` dumps the parse tree
- `f18 -fdebug-dump-parse-tree -fsyntax-only src.f90` dumps the parse tree
- `f18 -funparse src.f90` converts the parse tree to normalized Fortran
## Validate Labels and Canonicalize Do Statements
@ -74,7 +74,7 @@ See: [Preprocessing.md](Preprocessing.md).
**Entry points:** `semantics::ResolveNames`, `semantics::RewriteParseTree`
**Command:** `f18 -fdebug-dump-symbols -fparse-only src.f90` dumps the
**Command:** `f18 -fdebug-dump-symbols -fsyntax-only src.f90` dumps the
tree of scopes and symbols in each scope
## Check DO CONCURRENT Constraints

View file

@ -32,7 +32,7 @@ temp=$1
mkdir -p $temp
shift
CMD="$* -fdebug-dump-symbols -fparse-only"
CMD="$* -fdebug-dump-symbols -fsyntax-only"
# Check if tests should assume folding is using libpgmath
if [[ $LIBPGMATH ]]; then

View file

@ -1,5 +1,5 @@
! RUN: not %flang-new -fc1 -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=ERROR
! RUN: not %f18 -parse-only %s 2>&1 | FileCheck %s --check-prefix=ERROR
! RUN: not %f18 -syntax-only %s 2>&1 | FileCheck %s --check-prefix=ERROR
! REQUIRES: new-flang-driver

View file

@ -1,5 +1,5 @@
! RUN: not %flang-new -fc1 -fsyntax-only %s 2>&1 | FileCheck %s
! RUN: not %f18 -fparse-only %s 2>&1 | FileCheck %s
! RUN: not %f18 -fsyntax-only %s 2>&1 | FileCheck %s
! REQUIRES: new-flang-driver

View file

@ -6,7 +6,7 @@
! RUN: %flang-new -fc1 -E -I %S/Inputs/ %s 2>&1 | FileCheck %s
! Test with -fsyntax-only (i.e. ParseSyntaxOnlyAction, stops after semantic checks)
! RUN: %f18 -fparse-only -I %S/Inputs/ %s 2>&1 | FileCheck %s
! RUN: %f18 -fsyntax-only -I %S/Inputs/ %s 2>&1 | FileCheck %s
! RUN: %flang-new -fsyntax-only -I %S/Inputs/ %s 2>&1 | FileCheck %s
! RUN: %flang-new -fc1 -fsyntax-only -I %S/Inputs/ %s 2>&1 | FileCheck %s

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fdebug-pre-fir-tree -fparse-only %s | FileCheck %s
! RUN: %f18 -fdebug-pre-fir-tree -fsyntax-only %s | FileCheck %s
! Test structure of the Pre-FIR tree

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fdebug-pre-fir-tree -fparse-only %s | FileCheck %s
! RUN: %f18 -fdebug-pre-fir-tree -fsyntax-only %s | FileCheck %s
! Test Pre-FIR Tree captures all the intended nodes from the parse-tree
! Coarray and OpenMP related nodes are tested in other files.

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fdebug-pre-fir-tree -fparse-only -fopenmp %s | FileCheck %s
! RUN: %f18 -fdebug-pre-fir-tree -fsyntax-only -fopenmp %s | FileCheck %s
! Test Pre-FIR Tree captures OpenMP related constructs

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fdebug-pre-fir-tree -fparse-only %s | FileCheck %s
! RUN: %f18 -fdebug-pre-fir-tree -fsyntax-only %s | FileCheck %s
! Test Pre-FIR Tree captures all the coarray related statements

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fdebug-pre-fir-tree -fparse-only -fopenacc %s | FileCheck %s
! RUN: %f18 -fdebug-pre-fir-tree -fsyntax-only -fopenacc %s | FileCheck %s
! Test structure of the Pre-FIR tree with OpenACC construct

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fparse-only $s 2>&1 | FileCheck %s
! RUN: %f18 -fsyntax-only $s 2>&1 | FileCheck %s
! Regression test: don't emit a bogus error about an invalid specification expression
! in the declaration of a binding

View file

@ -1,4 +1,4 @@
!RUN: %f18 -fdebug-dump-symbols -fparse-only %s | FileCheck %s
!RUN: %f18 -fdebug-dump-symbols -fsyntax-only %s | FileCheck %s
module m
interface
integer function ifunc(n)

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fdebug-dump-symbols -fparse-only %s 2>&1 | FileCheck %s
! RUN: %f18 -fdebug-dump-symbols -fsyntax-only %s 2>&1 | FileCheck %s
! CHECK: DATA statement value initializes 'jx' of type 'INTEGER(4)' with CHARACTER
! CHECK: DATA statement value initializes 'jy' of type 'INTEGER(4)' with CHARACTER
! CHECK: DATA statement value initializes 'jz' of type 'INTEGER(4)' with CHARACTER

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fparse-only -fdebug-dump-symbols %s 2>&1 | FileCheck %s
! RUN: %f18 -fsyntax-only -fdebug-dump-symbols %s 2>&1 | FileCheck %s
! CHECK: init:[INTEGER(4)::1065353216_4,1073741824_4,1077936128_4,1082130432_4]
! Verify that the closure of EQUIVALENCE'd symbols with any DATA
! initialization produces a combined initializer.

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fparse-only %s
! RUN: %f18 -fsyntax-only %s
! RUN: rm -rf %t && mkdir %t
! RUN: touch %t/empty.f90
! RUN: %f18 -fparse-only %t/empty.f90
! RUN: %f18 -fsyntax-only %t/empty.f90

View file

@ -1,4 +1,4 @@
!RUN: %f18 -fparse-only %s 2>&1 | FileCheck %s
!RUN: %f18 -fsyntax-only %s 2>&1 | FileCheck %s
module m
type :: t1
integer :: n

View file

@ -16,12 +16,12 @@ contains
end module
! RUN and CHECK lines at the bottom as this test is sensitive to line numbers
! RUN: %f18 -fget-definition 6 17 18 -fparse-only %s | FileCheck --check-prefix=CHECK1 %s
! RUN: %f18 -fget-definition 7 20 23 -fparse-only %s | FileCheck --check-prefix=CHECK2 %s
! RUN: %f18 -fget-definition 14 3 4 -fparse-only %s | FileCheck --check-prefix=CHECK3 %s
! RUN: %f18 -fget-definition 6 17 18 -fsyntax-only %s | FileCheck --check-prefix=CHECK1 %s
! RUN: %f18 -fget-definition 7 20 23 -fsyntax-only %s | FileCheck --check-prefix=CHECK2 %s
! RUN: %f18 -fget-definition 14 3 4 -fsyntax-only %s | FileCheck --check-prefix=CHECK3 %s
! CHECK1: x:{{.*}}getdefinition01.f90, 5, 21-22
! CHECK2: yyy:{{.*}}getdefinition01.f90, 5, 24-27
! CHECK3: x:{{.*}}getdefinition01.f90, 13, 24-25
! RUN: not %f18 -fget-definition -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
! RUN: not %f18 -fget-definition -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
! CHECK-ERROR: Invalid argument to -fget-definitions

View file

@ -17,9 +17,9 @@
end module
! RUN and CHECK lines here as test is sensitive to line numbers
! RUN: %f18 -fget-definition 7 9 10 -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
! RUN: %f18 -fget-definition 8 26 29 -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK2 %s
! RUN: %f18 -fget-definition 15 9 10 -fparse-only %s 2>&1 | FileCheck --check-prefix=CHECK3 %s
! RUN: %f18 -fget-definition 7 9 10 -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
! RUN: %f18 -fget-definition 8 26 29 -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK2 %s
! RUN: %f18 -fget-definition 15 9 10 -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK3 %s
! CHECK1: x:{{.*}}getdefinition02.f, 5, 27-28
! CHECK2: yyy:{{.*}}getdefinition02.f, 5, 30-33
! CHECK3: x:{{.*}}getdefinition02.f, 14, 30-31

View file

@ -7,7 +7,7 @@ program main
x = f
end program
! RUN: %f18 -fget-definition 7 6 7 -fparse-only %s | FileCheck --check-prefix=CHECK1 %s
! RUN: %f18 -fget-definition 7 2 3 -fparse-only %s | FileCheck --check-prefix=CHECK2 %s
! RUN: %f18 -fget-definition 7 6 7 -fsyntax-only %s | FileCheck --check-prefix=CHECK1 %s
! RUN: %f18 -fget-definition 7 2 3 -fsyntax-only %s | FileCheck --check-prefix=CHECK2 %s
! CHECK1: f:{{.*}}getdefinition03-b.f90, 2, 12-13
! CHECK2: x:{{.*}}getdefinition03-a.f90, 6, 13-14

View file

@ -6,5 +6,5 @@ program main
x = y
end program
! RUN: %f18 -fget-definition 6 3 4 -fparse-only %s | FileCheck %s
! RUN: %f18 -fget-definition 6 3 4 -fsyntax-only %s | FileCheck %s
! CHECK: x:{{.*}}getdefinition04.f90, 3, 14-15

View file

@ -12,8 +12,8 @@ program main
end program
!! Inner x
! RUN: %f18 -fget-definition 9 5 6 -fparse-only %s | FileCheck --check-prefix=CHECK1 %s
! RUN: %f18 -fget-definition 9 5 6 -fsyntax-only %s | FileCheck --check-prefix=CHECK1 %s
! CHECK1: x:{{.*}}getdefinition05.f90, 7, 16-17
!! Outer y
! RUN: %f18 -fget-definition 11 7 8 -fparse-only %s | FileCheck --check-prefix=CHECK2 %s
! RUN: %f18 -fget-definition 11 7 8 -fsyntax-only %s | FileCheck --check-prefix=CHECK2 %s
! CHECK2: y:{{.*}}getdefinition05.f90, 5, 14-15

View file

@ -15,7 +15,7 @@ contains
end function
end module
! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s
! CHECK-COUNT-1:f:{{.*}}getsymbols01.f90, 12, 26-27
! CHECK-COUNT-1:mm1:{{.*}}getsymbols01.f90, 2, 8-11
! CHECK-COUNT-1:s:{{.*}}getsymbols01.f90, 5, 18-19

View file

@ -7,8 +7,8 @@ PROGRAM helloworld
i = callget5()
ENDPROGRAM
! RUN: %f18 -fparse-only %S/Inputs/getsymbols02-a.f90
! RUN: %f18 -fparse-only %S/Inputs/getsymbols02-b.f90
! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
! RUN: %f18 -fsyntax-only %S/Inputs/getsymbols02-a.f90
! RUN: %f18 -fsyntax-only %S/Inputs/getsymbols02-b.f90
! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s
! CHECK: callget5: .{{[/\\]}}mm2b.mod,
! CHECK: get5: .{{[/\\]}}mm2a.mod,

View file

@ -7,7 +7,7 @@ program main
x = f
end program
! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s
! CHECK:f:{{.*}}getsymbols03-b.f90, 2, 12-13
! CHECK:main:{{.*}}getsymbols03-a.f90, 4, 9-13
! CHECK:mm3:{{.*}}getsymbols03-a.f90, 5, 6-9

View file

@ -6,7 +6,7 @@ program main
x = y
end program
! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s
! CHECK:x:{{.*}}getsymbols04.f90, 3, 14-15
! CHECK:x:{{.*}}getsymbols04.f90, 5, 11-12
! CHECK:y:{{.*}}getsymbols04.f90, 4, 14-15

View file

@ -9,7 +9,7 @@ program main
x = y
end program
! RUN: %f18 -fget-symbols-sources -fparse-only %s 2>&1 | FileCheck %s
! RUN: %f18 -fget-symbols-sources -fsyntax-only %s 2>&1 | FileCheck %s
! CHECK:x:{{.*}}getsymbols05.f90, 3, 14-15
! CHECK:x:{{.*}}getsymbols05.f90, 6, 16-17
! CHECK:y:{{.*}}getsymbols05.f90, 4, 14-15

View file

@ -1,4 +1,4 @@
! RUN: echo -n "end program" > %t.f90
! RUN: %f18 -fparse-only %t.f90
! RUN: %f18 -fsyntax-only %t.f90
! RUN: echo -ne "\rend program" > %t.f90
! RUN: %f18 -fparse-only %t.f90
! RUN: %f18 -fsyntax-only %t.f90

View file

@ -1,8 +1,8 @@
! RUN: rm -fr %t && mkdir %t && cd %t
! RUN: %f18 -fparse-only -fdebug-module-writer %s 2>&1 | FileCheck %s --check-prefix CHECK_CHANGED
! RUN: %f18 -fparse-only -fdebug-module-writer %s 2>&1 | FileCheck %s --check-prefix CHECK_UNCHANGED
! RUN: %f18 -fparse-only -fdebug-module-writer %p/Inputs/mod-file-unchanged.f90 2>&1 | FileCheck %s --check-prefix CHECK_UNCHANGED
! RUN: %f18 -fparse-only -fdebug-module-writer %p/Inputs/mod-file-changed.f90 2>&1 | FileCheck %s --check-prefix CHECK_CHANGED
! RUN: %f18 -fsyntax-only -fdebug-module-writer %s 2>&1 | FileCheck %s --check-prefix CHECK_CHANGED
! RUN: %f18 -fsyntax-only -fdebug-module-writer %s 2>&1 | FileCheck %s --check-prefix CHECK_UNCHANGED
! RUN: %f18 -fsyntax-only -fdebug-module-writer %p/Inputs/mod-file-unchanged.f90 2>&1 | FileCheck %s --check-prefix CHECK_UNCHANGED
! RUN: %f18 -fsyntax-only -fdebug-module-writer %p/Inputs/mod-file-changed.f90 2>&1 | FileCheck %s --check-prefix CHECK_CHANGED
module m
real :: x(10)

View file

@ -1,4 +1,4 @@
! RUN: not %f18 -fparse-only %s 2>&1 | FileCheck %s
! RUN: not %f18 -fsyntax-only %s 2>&1 | FileCheck %s
! Test WhyNotModifiable() explanations
module prot

View file

@ -1,4 +1,4 @@
!RUN: %f18 -fdebug-dump-symbols -fparse-only %s | FileCheck %s
!RUN: %f18 -fdebug-dump-symbols -fsyntax-only %s | FileCheck %s
! Size and alignment of intrinsic types
subroutine s1

View file

@ -1,4 +1,4 @@
!RUN: %f18 -fdebug-dump-symbols -fparse-only %s | FileCheck %s
!RUN: %f18 -fdebug-dump-symbols -fsyntax-only %s | FileCheck %s
! Size and alignment of derived types

View file

@ -1,4 +1,4 @@
!RUN: %f18 -fdebug-dump-symbols -fparse-only %s | FileCheck %s
!RUN: %f18 -fdebug-dump-symbols -fsyntax-only %s | FileCheck %s
! Size and alignment with EQUIVALENCE and COMMON

View file

@ -1,4 +1,4 @@
! RUN: %f18 -falternative-parameter-statement -fdebug-dump-symbols -fparse-only %s 2>&1 | FileCheck %s
! RUN: %f18 -falternative-parameter-statement -fdebug-dump-symbols -fsyntax-only %s 2>&1 | FileCheck %s
! Non-error tests for "old style" PARAMETER statements

View file

@ -1,4 +1,4 @@
! RUN: not %f18 -falternative-parameter-statement -fdebug-dump-symbols -fparse-only %s 2>&1 | FileCheck %s
! RUN: not %f18 -falternative-parameter-statement -fdebug-dump-symbols -fsyntax-only %s 2>&1 | FileCheck %s
! Error tests for "old style" PARAMETER statements
subroutine subr(x1,x2,x3,x4,x5)

View file

@ -1,4 +1,4 @@
! RUN: not %f18 -fparse-only %s 2>&1 | FileCheck %s
! RUN: not %f18 -fsyntax-only %s 2>&1 | FileCheck %s
! Ensure that old-style PARAMETER statements are disabled by default.

View file

@ -1,4 +1,4 @@
!RUN: %f18 -fdebug-dump-symbols -fparse-only %s | FileCheck %s
!RUN: %f18 -fdebug-dump-symbols -fsyntax-only %s | FileCheck %s
program p
! CHECK: a size=4 offset=0: ObjectEntity type: LOGICAL(4)

View file

@ -1,4 +1,4 @@
! RUN: %f18 -fparse-only -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s
! RUN: %f18 -fsyntax-only -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s
! Ensure that READ(CVAR) [, item-list] is corrected when CVAR is a
! character variable so as to be a formatted read from the default
! unit, not an unformatted read from an internal unit (which is not

View file

@ -2,7 +2,7 @@
# Compile a source file and check errors against those listed in the file.
# Change the compiler by setting the F18 environment variable.
F18_OPTIONS="-fparse-only"
F18_OPTIONS="-fsyntax-only"
srcdir=$(dirname $0)
source $srcdir/common.sh
[[ ! -f $src ]] && die "File not found: $src"

View file

@ -2,7 +2,7 @@
# Compile a source file and compare generated .mod files against expected.
set -e
F18_OPTIONS="-fdebug-resolve-names -fparse-only"
F18_OPTIONS="-fdebug-resolve-names -fsyntax-only"
srcdir=$(dirname $0)
source $srcdir/common.sh

View file

@ -1,4 +1,4 @@
!RUN: %f18 -fdebug-dump-symbols -fparse-only %s | FileCheck %s
!RUN: %f18 -fdebug-dump-symbols -fsyntax-only %s | FileCheck %s
! Tests for derived type runtime descriptions
module m01

View file

@ -87,7 +87,7 @@ struct DriverOptions {
bool warnOnNonstandardUsage{false}; // -Mstandard
bool warningsAreErrors{false}; // -Werror
Fortran::parser::Encoding encoding{Fortran::parser::Encoding::LATIN_1};
bool parseOnly{false};
bool syntaxOnly{false};
bool dumpProvenance{false};
bool dumpCookedChars{false};
bool dumpUnparse{false};
@ -217,7 +217,7 @@ std::string CompileFortran(
Fortran::common::LanguageFeature::BackslashEscapes));
return {};
}
if (driver.parseOnly) {
if (driver.syntaxOnly) {
return {};
}
@ -369,8 +369,8 @@ int main(int argc, char *const argv[]) {
driver.dumpUnparse = true;
} else if (arg == "-ftime-parse") {
driver.timeParse = true;
} else if (arg == "-fparse-only") {
driver.parseOnly = true;
} else if (arg == "-fparse-only" || arg == "-fsyntax-only") {
driver.syntaxOnly = true;
} else if (arg == "-c") {
driver.compileOnly = true;
} else if (arg == "-o") {
@ -405,7 +405,7 @@ int main(int argc, char *const argv[]) {
<< " -ed enable fixed form D lines\n"
<< " -E prescan & preprocess only\n"
<< " -ftime-parse measure parsing time\n"
<< " -fparse-only parse only, no output except messages\n"
<< " -fsyntax-only parse only, no output except messages\n"
<< " -funparse parse & reformat only, no code "
"generation\n"
<< " -fdump-provenance dump the provenance table (no code)\n"

View file

@ -46,7 +46,7 @@ foreach(filename ${MODULES})
set(depends ${include}/__fortran_builtins.mod)
endif()
add_custom_command(OUTPUT ${include}/${filename}.mod
COMMAND f18 -fparse-only -I${include}
COMMAND f18 -fsyntax-only -I${include}
${FLANG_SOURCE_DIR}/module/${filename}.f90
WORKING_DIRECTORY ${include}
DEPENDS f18 ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends}

View file

@ -92,7 +92,7 @@ struct DriverOptions {
bool warningsAreErrors{false}; // -Werror
bool byteswapio{false}; // -byteswapio
Fortran::parser::Encoding encoding{Fortran::parser::Encoding::UTF_8};
bool parseOnly{false};
bool syntaxOnly{false};
bool dumpProvenance{false};
bool dumpCookedChars{false};
bool dumpUnparse{false};
@ -327,7 +327,7 @@ std::string CompileFortran(std::string path, Fortran::parser::Options options,
exitStatus = EXIT_FAILURE;
}
}
if (driver.parseOnly) {
if (driver.syntaxOnly) {
return {};
}
@ -544,8 +544,8 @@ int main(int argc, char *const argv[]) {
driver.dumpUnparseWithSymbols = true;
} else if (arg == "-funparse-typed-exprs-to-f18-fc") {
driver.unparseTypedExprsToF18_FC = true;
} else if (arg == "-fparse-only") {
driver.parseOnly = true;
} else if (arg == "-fparse-only" || arg == "-fsyntax-only") {
driver.syntaxOnly = true;
} else if (arg == "-c") {
driver.compileOnly = true;
} else if (arg == "-o") {
@ -649,7 +649,7 @@ int main(int argc, char *const argv[]) {
<< " -module dir module output directory (default .)\n"
<< " -flatin interpret source as Latin-1 (ISO 8859-1) "
"rather than UTF-8\n"
<< " -fparse-only parse only, no output except messages\n"
<< " -fsyntax-only parsing and semantics only, no output except messages\n"
<< " -funparse parse & reformat only, no code "
"generation\n"
<< " -funparse-with-symbols parse, resolve symbols, and unparse\n"