[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/DavidTruby closed https://github.com/llvm/llvm-project/pull/133775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/DavidTruby updated https://github.com/llvm/llvm-project/pull/133775 >From aeca7c2c7bf4cc7aef87374f3890f2a42e61d07d Mon Sep 17 00:00:00 2001 From: David Truby Date: Mon, 31 Mar 2025 19:39:37 +0100 Subject: [PATCH 1/3] [flang] Complete alignment of -x language modes with gfortran This fixes an issue where, since the alignment of the -x lanaguage modes, .f90 files were being preprocessed by default. This patch completes the alignment of the meaning of the f95-pp-input and f95 language modes to match gfortran, fixing that issue. --- clang/include/clang/Driver/Types.def | 4 ++-- .../Driver/input-from-stdin/input-from-stdin.f90 | 2 +- flang/test/Driver/phases.f90 | 12 ++-- flang/test/Driver/pp-fixed-form.f90 | 16 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def index 214c5e7a789f9..2b6b3e75c1c97 100644 --- a/clang/include/clang/Driver/Types.def +++ b/clang/include/clang/Driver/Types.def @@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) -TYPE("f95-cpp-input",Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95-cpp-input",PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // LLVM IR/LTO types. We define separate types for IR and LTO because LTO diff --git a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 index 1fcc0340a64ba..285f0751b35d8 100644 --- a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 +++ b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 @@ -6,7 +6,7 @@ ! Input type is implicit ! RUN: cat %s | %flang -E -cpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -cpp - | FileCheck %s --check-prefix=PP-DEFINED -! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-DEFINED +! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -nocpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! Input type is explicit diff --git a/flang/test/Driver/phases.f90 b/flang/test/Driver/phases.f90 index b688600dae035..9346773c883ef 100644 --- a/flang/test/Driver/phases.f90 +++ b/flang/test/Driver/phases.f90 @@ -4,15 +4,15 @@ ! RUN: %flang -fsyntax-only -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=COMPILE ! RUN: %flang -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=EMIT_OBJ -! PP: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! PP-NEXT: 1: preprocessor, {0}, f95 +! PP: +- 0: input, "{{.*}}phases.f90", f95 +! PP-NEXT: 1: preprocessor, {0}, f95-cpp-input -! COMPILE: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! COMPILE-NEXT: 1: preprocessor, {0}, f95 +! COMPILE: +- 0: input, "{{.*}}phases.f90", f95 +! COMPILE-NEXT: 1: preprocessor, {0}, f95-cpp-input ! COMPILE-NEXT: 2: compiler, {1}, none -! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95 +! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95 +! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95-cpp-input ! EMIT_OBJ-NEXT: 2: compiler, {1}, ir ! EMIT_OBJ-NEXT: +- 3: backend, {2}, assembler ! EMIT_OBJ-NEXT: 4: assembler, {3}, object diff --git a/flang/test/Driver/pp-fixed-form.f90 b/flang/test/Driver/pp-fixed-form.f90 index 4695da78763ae..bb869cd3341a7 100644 --- a/flang/test/Driver/pp-fixed-form.f90 +++ b/flang/test/Driver/pp-fixed-form.f90 @@ -1,19 +1,19 @@ !RUN: %flang -save-temps -### %S/Inputs/free-form-test.f90 2>&1 | FileCheck %s --check-prefix=FREE -FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/free-form-test.f90" -FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "free-form-test.i" +FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95" "{{.*}}/free-form-test.f90" +FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95-cpp-input" "free-form-test.i" !RUN: %flang -save-temps -### %S/Inputs/fixed-form-test.f 2>&1 | FileCheck %s --check-prefix=FIXED -FIXED: "-fc1"
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/DavidTruby updated https://github.com/llvm/llvm-project/pull/133775 >From aeca7c2c7bf4cc7aef87374f3890f2a42e61d07d Mon Sep 17 00:00:00 2001 From: David Truby Date: Mon, 31 Mar 2025 19:39:37 +0100 Subject: [PATCH 1/2] [flang] Complete alignment of -x language modes with gfortran This fixes an issue where, since the alignment of the -x lanaguage modes, .f90 files were being preprocessed by default. This patch completes the alignment of the meaning of the f95-pp-input and f95 language modes to match gfortran, fixing that issue. --- clang/include/clang/Driver/Types.def | 4 ++-- .../Driver/input-from-stdin/input-from-stdin.f90 | 2 +- flang/test/Driver/phases.f90 | 12 ++-- flang/test/Driver/pp-fixed-form.f90 | 16 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def index 214c5e7a789f9..2b6b3e75c1c97 100644 --- a/clang/include/clang/Driver/Types.def +++ b/clang/include/clang/Driver/Types.def @@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) -TYPE("f95-cpp-input",Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95-cpp-input",PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // LLVM IR/LTO types. We define separate types for IR and LTO because LTO diff --git a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 index 1fcc0340a64ba..285f0751b35d8 100644 --- a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 +++ b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 @@ -6,7 +6,7 @@ ! Input type is implicit ! RUN: cat %s | %flang -E -cpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -cpp - | FileCheck %s --check-prefix=PP-DEFINED -! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-DEFINED +! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -nocpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! Input type is explicit diff --git a/flang/test/Driver/phases.f90 b/flang/test/Driver/phases.f90 index b688600dae035..9346773c883ef 100644 --- a/flang/test/Driver/phases.f90 +++ b/flang/test/Driver/phases.f90 @@ -4,15 +4,15 @@ ! RUN: %flang -fsyntax-only -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=COMPILE ! RUN: %flang -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=EMIT_OBJ -! PP: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! PP-NEXT: 1: preprocessor, {0}, f95 +! PP: +- 0: input, "{{.*}}phases.f90", f95 +! PP-NEXT: 1: preprocessor, {0}, f95-cpp-input -! COMPILE: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! COMPILE-NEXT: 1: preprocessor, {0}, f95 +! COMPILE: +- 0: input, "{{.*}}phases.f90", f95 +! COMPILE-NEXT: 1: preprocessor, {0}, f95-cpp-input ! COMPILE-NEXT: 2: compiler, {1}, none -! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95 +! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95 +! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95-cpp-input ! EMIT_OBJ-NEXT: 2: compiler, {1}, ir ! EMIT_OBJ-NEXT: +- 3: backend, {2}, assembler ! EMIT_OBJ-NEXT: 4: assembler, {3}, object diff --git a/flang/test/Driver/pp-fixed-form.f90 b/flang/test/Driver/pp-fixed-form.f90 index 4695da78763ae..bb869cd3341a7 100644 --- a/flang/test/Driver/pp-fixed-form.f90 +++ b/flang/test/Driver/pp-fixed-form.f90 @@ -1,19 +1,19 @@ !RUN: %flang -save-temps -### %S/Inputs/free-form-test.f90 2>&1 | FileCheck %s --check-prefix=FREE -FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/free-form-test.f90" -FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "free-form-test.i" +FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95" "{{.*}}/free-form-test.f90" +FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95-cpp-input" "free-form-test.i" !RUN: %flang -save-temps -### %S/Inputs/fixed-form-test.f 2>&1 | FileCheck %s --check-prefix=FIXED -FIXED: "-fc1"
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
llvmbot wrote: @llvm/pr-subscribers-flang-driver Author: David Truby (DavidTruby) Changes This fixes an issue where, since the alignment of the -x lanaguage modes, .f90 files were being preprocessed by default. This patch completes the alignment of the meaning of the f95-pp-input and f95 language modes to match gfortran, fixing that issue. --- Full diff: https://github.com/llvm/llvm-project/pull/133775.diff 4 Files Affected: - (modified) clang/include/clang/Driver/Types.def (+2-2) - (modified) flang/test/Driver/input-from-stdin/input-from-stdin.f90 (+1-1) - (modified) flang/test/Driver/phases.f90 (+6-6) - (modified) flang/test/Driver/pp-fixed-form.f90 (+8-8) ``diff diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def index 214c5e7a789f9..2b6b3e75c1c97 100644 --- a/clang/include/clang/Driver/Types.def +++ b/clang/include/clang/Driver/Types.def @@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) -TYPE("f95-cpp-input",Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95-cpp-input",PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // LLVM IR/LTO types. We define separate types for IR and LTO because LTO diff --git a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 index 1fcc0340a64ba..285f0751b35d8 100644 --- a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 +++ b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 @@ -6,7 +6,7 @@ ! Input type is implicit ! RUN: cat %s | %flang -E -cpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -cpp - | FileCheck %s --check-prefix=PP-DEFINED -! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-DEFINED +! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -nocpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! Input type is explicit diff --git a/flang/test/Driver/phases.f90 b/flang/test/Driver/phases.f90 index b688600dae035..9346773c883ef 100644 --- a/flang/test/Driver/phases.f90 +++ b/flang/test/Driver/phases.f90 @@ -4,15 +4,15 @@ ! RUN: %flang -fsyntax-only -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=COMPILE ! RUN: %flang -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=EMIT_OBJ -! PP: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! PP-NEXT: 1: preprocessor, {0}, f95 +! PP: +- 0: input, "{{.*}}phases.f90", f95 +! PP-NEXT: 1: preprocessor, {0}, f95-cpp-input -! COMPILE: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! COMPILE-NEXT: 1: preprocessor, {0}, f95 +! COMPILE: +- 0: input, "{{.*}}phases.f90", f95 +! COMPILE-NEXT: 1: preprocessor, {0}, f95-cpp-input ! COMPILE-NEXT: 2: compiler, {1}, none -! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95 +! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95 +! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95-cpp-input ! EMIT_OBJ-NEXT: 2: compiler, {1}, ir ! EMIT_OBJ-NEXT: +- 3: backend, {2}, assembler ! EMIT_OBJ-NEXT: 4: assembler, {3}, object diff --git a/flang/test/Driver/pp-fixed-form.f90 b/flang/test/Driver/pp-fixed-form.f90 index 4695da78763ae..bb869cd3341a7 100644 --- a/flang/test/Driver/pp-fixed-form.f90 +++ b/flang/test/Driver/pp-fixed-form.f90 @@ -1,19 +1,19 @@ !RUN: %flang -save-temps -### %S/Inputs/free-form-test.f90 2>&1 | FileCheck %s --check-prefix=FREE -FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/free-form-test.f90" -FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "free-form-test.i" +FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95" "{{.*}}/free-form-test.f90" +FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95-cpp-input" "free-form-test.i" !RUN: %flang -save-temps -### %S/Inputs/fixed-form-test.f 2>&1 | FileCheck %s --check-prefix=FIXED -FIXED: "-fc1" {{.*}} "-o" "fixed-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/fixed-form-test.f" -FIXED-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "fixed-form-test.i"
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/tarunprabhu approved this pull request. Thanks for the changes, David. :-) https://github.com/llvm/llvm-project/pull/133775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/DavidTruby updated https://github.com/llvm/llvm-project/pull/133775 >From aeca7c2c7bf4cc7aef87374f3890f2a42e61d07d Mon Sep 17 00:00:00 2001 From: David Truby Date: Mon, 31 Mar 2025 19:39:37 +0100 Subject: [PATCH 1/2] [flang] Complete alignment of -x language modes with gfortran This fixes an issue where, since the alignment of the -x lanaguage modes, .f90 files were being preprocessed by default. This patch completes the alignment of the meaning of the f95-pp-input and f95 language modes to match gfortran, fixing that issue. --- clang/include/clang/Driver/Types.def | 4 ++-- .../Driver/input-from-stdin/input-from-stdin.f90 | 2 +- flang/test/Driver/phases.f90 | 12 ++-- flang/test/Driver/pp-fixed-form.f90 | 16 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def index 214c5e7a789f9..2b6b3e75c1c97 100644 --- a/clang/include/clang/Driver/Types.def +++ b/clang/include/clang/Driver/Types.def @@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) -TYPE("f95-cpp-input",Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95-cpp-input",PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // LLVM IR/LTO types. We define separate types for IR and LTO because LTO diff --git a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 index 1fcc0340a64ba..285f0751b35d8 100644 --- a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 +++ b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 @@ -6,7 +6,7 @@ ! Input type is implicit ! RUN: cat %s | %flang -E -cpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -cpp - | FileCheck %s --check-prefix=PP-DEFINED -! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-DEFINED +! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -nocpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! Input type is explicit diff --git a/flang/test/Driver/phases.f90 b/flang/test/Driver/phases.f90 index b688600dae035..9346773c883ef 100644 --- a/flang/test/Driver/phases.f90 +++ b/flang/test/Driver/phases.f90 @@ -4,15 +4,15 @@ ! RUN: %flang -fsyntax-only -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=COMPILE ! RUN: %flang -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=EMIT_OBJ -! PP: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! PP-NEXT: 1: preprocessor, {0}, f95 +! PP: +- 0: input, "{{.*}}phases.f90", f95 +! PP-NEXT: 1: preprocessor, {0}, f95-cpp-input -! COMPILE: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! COMPILE-NEXT: 1: preprocessor, {0}, f95 +! COMPILE: +- 0: input, "{{.*}}phases.f90", f95 +! COMPILE-NEXT: 1: preprocessor, {0}, f95-cpp-input ! COMPILE-NEXT: 2: compiler, {1}, none -! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95 +! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95 +! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95-cpp-input ! EMIT_OBJ-NEXT: 2: compiler, {1}, ir ! EMIT_OBJ-NEXT: +- 3: backend, {2}, assembler ! EMIT_OBJ-NEXT: 4: assembler, {3}, object diff --git a/flang/test/Driver/pp-fixed-form.f90 b/flang/test/Driver/pp-fixed-form.f90 index 4695da78763ae..bb869cd3341a7 100644 --- a/flang/test/Driver/pp-fixed-form.f90 +++ b/flang/test/Driver/pp-fixed-form.f90 @@ -1,19 +1,19 @@ !RUN: %flang -save-temps -### %S/Inputs/free-form-test.f90 2>&1 | FileCheck %s --check-prefix=FREE -FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/free-form-test.f90" -FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "free-form-test.i" +FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95" "{{.*}}/free-form-test.f90" +FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95-cpp-input" "free-form-test.i" !RUN: %flang -save-temps -### %S/Inputs/fixed-form-test.f 2>&1 | FileCheck %s --check-prefix=FIXED -FIXED: "-fc1"
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/tarunprabhu edited https://github.com/llvm/llvm-project/pull/133775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
@@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) DavidTruby wrote: I'll post that tomorrow in the hope that the build bots have calmed down by then, since precommit seems to be failing for everyone atm https://github.com/llvm/llvm-project/pull/133775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
@@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) tarunprabhu wrote: Nit: In this line and the next could we try to preserve the "column" alignment https://github.com/llvm/llvm-project/pull/133775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/tarunprabhu commented: Other than the nit, this looks ok. However, I must admit that I don't fully understand the nuances of the various modes, and I got a bit lost with the previous PR as well, so I'll leave it to someone else to approve as they see fit. https://github.com/llvm/llvm-project/pull/133775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
llvmbot wrote: @llvm/pr-subscribers-clang Author: David Truby (DavidTruby) Changes This fixes an issue where, since the alignment of the -x lanaguage modes, .f90 files were being preprocessed by default. This patch completes the alignment of the meaning of the f95-pp-input and f95 language modes to match gfortran, fixing that issue. --- Full diff: https://github.com/llvm/llvm-project/pull/133775.diff 4 Files Affected: - (modified) clang/include/clang/Driver/Types.def (+2-2) - (modified) flang/test/Driver/input-from-stdin/input-from-stdin.f90 (+1-1) - (modified) flang/test/Driver/phases.f90 (+6-6) - (modified) flang/test/Driver/pp-fixed-form.f90 (+8-8) ``diff diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def index 214c5e7a789f9..2b6b3e75c1c97 100644 --- a/clang/include/clang/Driver/Types.def +++ b/clang/include/clang/Driver/Types.def @@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) -TYPE("f95-cpp-input",Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95-cpp-input",PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // LLVM IR/LTO types. We define separate types for IR and LTO because LTO diff --git a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 index 1fcc0340a64ba..285f0751b35d8 100644 --- a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 +++ b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 @@ -6,7 +6,7 @@ ! Input type is implicit ! RUN: cat %s | %flang -E -cpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -cpp - | FileCheck %s --check-prefix=PP-DEFINED -! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-DEFINED +! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -nocpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! Input type is explicit diff --git a/flang/test/Driver/phases.f90 b/flang/test/Driver/phases.f90 index b688600dae035..9346773c883ef 100644 --- a/flang/test/Driver/phases.f90 +++ b/flang/test/Driver/phases.f90 @@ -4,15 +4,15 @@ ! RUN: %flang -fsyntax-only -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=COMPILE ! RUN: %flang -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=EMIT_OBJ -! PP: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! PP-NEXT: 1: preprocessor, {0}, f95 +! PP: +- 0: input, "{{.*}}phases.f90", f95 +! PP-NEXT: 1: preprocessor, {0}, f95-cpp-input -! COMPILE: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! COMPILE-NEXT: 1: preprocessor, {0}, f95 +! COMPILE: +- 0: input, "{{.*}}phases.f90", f95 +! COMPILE-NEXT: 1: preprocessor, {0}, f95-cpp-input ! COMPILE-NEXT: 2: compiler, {1}, none -! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95 +! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95 +! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95-cpp-input ! EMIT_OBJ-NEXT: 2: compiler, {1}, ir ! EMIT_OBJ-NEXT: +- 3: backend, {2}, assembler ! EMIT_OBJ-NEXT: 4: assembler, {3}, object diff --git a/flang/test/Driver/pp-fixed-form.f90 b/flang/test/Driver/pp-fixed-form.f90 index 4695da78763ae..bb869cd3341a7 100644 --- a/flang/test/Driver/pp-fixed-form.f90 +++ b/flang/test/Driver/pp-fixed-form.f90 @@ -1,19 +1,19 @@ !RUN: %flang -save-temps -### %S/Inputs/free-form-test.f90 2>&1 | FileCheck %s --check-prefix=FREE -FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/free-form-test.f90" -FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "free-form-test.i" +FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95" "{{.*}}/free-form-test.f90" +FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95-cpp-input" "free-form-test.i" !RUN: %flang -save-temps -### %S/Inputs/fixed-form-test.f 2>&1 | FileCheck %s --check-prefix=FIXED -FIXED: "-fc1" {{.*}} "-o" "fixed-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/fixed-form-test.f" -FIXED-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "fixed-form-test.i" +FIXED:
[clang] [flang] [flang] Complete alignment of -x language modes with gfortran (PR #133775)
https://github.com/DavidTruby created https://github.com/llvm/llvm-project/pull/133775 This fixes an issue where, since the alignment of the -x lanaguage modes, .f90 files were being preprocessed by default. This patch completes the alignment of the meaning of the f95-pp-input and f95 language modes to match gfortran, fixing that issue. >From aeca7c2c7bf4cc7aef87374f3890f2a42e61d07d Mon Sep 17 00:00:00 2001 From: David Truby Date: Mon, 31 Mar 2025 19:39:37 +0100 Subject: [PATCH] [flang] Complete alignment of -x language modes with gfortran This fixes an issue where, since the alignment of the -x lanaguage modes, .f90 files were being preprocessed by default. This patch completes the alignment of the meaning of the f95-pp-input and f95 language modes to match gfortran, fixing that issue. --- clang/include/clang/Driver/Types.def | 4 ++-- .../Driver/input-from-stdin/input-from-stdin.f90 | 2 +- flang/test/Driver/phases.f90 | 12 ++-- flang/test/Driver/pp-fixed-form.f90 | 16 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def index 214c5e7a789f9..2b6b3e75c1c97 100644 --- a/clang/include/clang/Driver/Types.def +++ b/clang/include/clang/Driver/Types.def @@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases // modules when Flang needs to emit pre-processed files. Therefore, the // `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with // "pre-processing a pre-processed file". -TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) -TYPE("f95-cpp-input",Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95-cpp-input",PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // LLVM IR/LTO types. We define separate types for IR and LTO because LTO diff --git a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 index 1fcc0340a64ba..285f0751b35d8 100644 --- a/flang/test/Driver/input-from-stdin/input-from-stdin.f90 +++ b/flang/test/Driver/input-from-stdin/input-from-stdin.f90 @@ -6,7 +6,7 @@ ! Input type is implicit ! RUN: cat %s | %flang -E -cpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -cpp - | FileCheck %s --check-prefix=PP-DEFINED -! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-DEFINED +! RUN: cat %s | %flang -DNEW -E - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! RUN: cat %s | %flang -DNEW -E -nocpp - | FileCheck %s --check-prefix=PP-NOT-DEFINED ! Input type is explicit diff --git a/flang/test/Driver/phases.f90 b/flang/test/Driver/phases.f90 index b688600dae035..9346773c883ef 100644 --- a/flang/test/Driver/phases.f90 +++ b/flang/test/Driver/phases.f90 @@ -4,15 +4,15 @@ ! RUN: %flang -fsyntax-only -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=COMPILE ! RUN: %flang -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=EMIT_OBJ -! PP: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! PP-NEXT: 1: preprocessor, {0}, f95 +! PP: +- 0: input, "{{.*}}phases.f90", f95 +! PP-NEXT: 1: preprocessor, {0}, f95-cpp-input -! COMPILE: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! COMPILE-NEXT: 1: preprocessor, {0}, f95 +! COMPILE: +- 0: input, "{{.*}}phases.f90", f95 +! COMPILE-NEXT: 1: preprocessor, {0}, f95-cpp-input ! COMPILE-NEXT: 2: compiler, {1}, none -! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95-cpp-input -! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95 +! EMIT_OBJ: +- 0: input, "{{.*}}phases.f90", f95 +! EMIT_OBJ-NEXT: 1: preprocessor, {0}, f95-cpp-input ! EMIT_OBJ-NEXT: 2: compiler, {1}, ir ! EMIT_OBJ-NEXT: +- 3: backend, {2}, assembler ! EMIT_OBJ-NEXT: 4: assembler, {3}, object diff --git a/flang/test/Driver/pp-fixed-form.f90 b/flang/test/Driver/pp-fixed-form.f90 index 4695da78763ae..bb869cd3341a7 100644 --- a/flang/test/Driver/pp-fixed-form.f90 +++ b/flang/test/Driver/pp-fixed-form.f90 @@ -1,19 +1,19 @@ !RUN: %flang -save-temps -### %S/Inputs/free-form-test.f90 2>&1 | FileCheck %s --check-prefix=FREE -FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x" "f95-cpp-input" "{{.*}}/free-form-test.f90" -FREE-NEXT: "-fc1" {{.*}} "-ffixed-form" {{.*}} "-x" "f95" "free-form-test.i" +FREE: "-fc1" {{.*}} "-o" "free-form-test.i" {{.*}} "-x"