Skip to content

Commit ef6532b

Browse files
authored
Add support for toggling Fortran features (#864)
- implicit-typing: toggle default implicit typing rules - option to disable in GFortran - option to enable in LFortran - implicit-external: toggle implicit external interfaces - option to disable in GFortran - option to enable in LFortran - source-form: select source form ("free", "fixed", or "default") - option to set free/fixed form in GFortran - option to set fixed form in LFortran
1 parent 55d94b0 commit ef6532b

File tree

19 files changed

+368
-12
lines changed

19 files changed

+368
-12
lines changed

ci/run_tests.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ pushd cpp_files
158158
"$fpm" test
159159
popd
160160

161+
# Test Fortran features
162+
for feature in free-form fixed-form implicit-typing implicit-external
163+
do
164+
pushd $feature
165+
"$fpm" run
166+
popd
167+
done
168+
161169
# Test app exit codes
162170
pushd fpm_test_exit_code
163171
"$fpm" build
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
program test
2+
use lib
3+
call hello
4+
end

example_packages/fixed-form/fpm.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name = "fixed-form"
2+
fortran.source-form = "fixed"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module lib
2+
contains
3+
subroutine h e l l o
4+
print '(a)',
5+
+"Hello, fixed world!"
6+
end subroutine
7+
end module

example_packages/free-form/app/main.f

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
program test
2+
use lib
3+
call hello
4+
end

example_packages/free-form/fpm.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name = "free-form"
2+
fortran.source-form = "free"
3+
executable = [{main="main.f", name="free-form"}]

example_packages/free-form/src/lib.f

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module lib
2+
contains
3+
subroutine hello
4+
print '(a)', "Hello, free world!"
5+
end subroutine
6+
end module
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program test
2+
integer :: ijk
3+
call impl(ijk)
4+
if (ijk /= 1) error stop
5+
end program test
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name = "implicit-external"
2+
fortran.implicit-external = true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
subroutine impl(ijk)
2+
integer :: ijk
3+
ijk = 1
4+
end subroutine impl

0 commit comments

Comments
 (0)