Skip to content

Commit 089f9dc

Browse files
committed
Update: tree-shaking test for external function case
1 parent 4c05a6f commit 089f9dc

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

example_packages/tree_shake/app/say_Hello.f90

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@ program say_Hello
33

44
implicit none
55

6+
interface
7+
function external_function() result(i)
8+
integer :: i
9+
end function external_function
10+
end interface
11+
612
print *, make_greeting("World")
13+
print *, external_function()
14+
715
end program say_Hello
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
! This module is not used by any other sources,
2+
! however because it also contains an external function
3+
! it cannot be dropped during tree-shaking/pruning
4+
module extra_m
5+
use subdir_constants, only: FAREWELL_STR
6+
implicit none
7+
private
8+
9+
integer, parameter :: m = 0
10+
end
11+
12+
function external_function() result(i)
13+
integer :: i
14+
i = 1
15+
end function external_function

example_packages/tree_shake/src/farewell_m.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
! This module is not used by any other sources
2+
! and only contains a module (no non-module subprograms),
3+
! therefore it should be dropped during tree-shaking/pruning
14
module farewell_m
25
use subdir_constants, only: FAREWELL_STR
36
implicit none

example_packages/tree_shake/src/greet_m.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
! This module is directly by the executables and
2+
! hence should not be dropped during tree-shaking/pruning
13
module greet_m
24
use subdir_constants, only: GREET_STR
35
implicit none

example_packages/tree_shake/src/subdir/constants.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
! This module is used indirectly by the executables
2+
! and hence should not be dropped during tree-shaking/pruning
13
module subdir_constants
24
implicit none
35

0 commit comments

Comments
 (0)