You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FORD type-bound procedures public/private policy (discussed a bit here in issue #508) has ramifications for call-graph display of type-bound procedures.
First some example code:
program main
use a_module
implicit none
type(a_module_t) :: a_module_t_obj
call a_module_t_obj%a_module_t_sub("There")
end program main
! ---------------------------
module a_module
implicit none
private
public :: a_module_t
! public :: a_module_t_sub ! THIS IS THE STATEMENT THAT ALLOWS THE TYPE-BOUND PROCEDURE
! TO BE DISPLAYED IN THE CALL-GRAPH
type a_module_t
private
integer :: a_module_t_int
contains
procedure :: a_module_t_sub
end type a_module_t
contains
subroutine a_module_t_sub(this, output)
implicit none
class(a_module_t), intent(in) :: this
character(len=*), intent(in) :: output !! character(len=*), intent(in) :: output
write(*,*) "a_module_t_sub: ", output
end subroutine a_module_t_sub
end module a_module
When graphs are generated for this code, the publicly accessible type-bound procedure a_module_t_sub() is not displayed in the main program's call graph. In fact, because the program only has the type-bound procedure call, no call-graph is generated at all for the program. If there were other procedure calls in the program that FORD considers "fully" public, then the call-graph would be generated (minus the non fully public type-bound procedure).
The solution to this is the same as getting the type-bound procedures to be listed on the FORD Procedures main page list and the Procedures webpage. Add
public :: a_module_t_sub
at the module level of a_module (commented in above code).
So, as with the display of type-bound procedures in the FORD Procedures list and webpage, we are forced to modify our Fortran code just to get FORD to document it in a way that it seems FORD should be able do without the code change.
The text was updated successfully, but these errors were encountered:
@ZedThree
A further wrinkle in this issue is when there is a binding name (i.e. sub in this case) added to the type-bound procedure from the above orginal code example:
type a_module_t
private
integer :: a_module_t_int
contains
procedure :: sub => a_module_t_sub
end type a_module_t
along with a main program call to the binding name
call a_module_t_obj%sub("There")
Regardless if there is a public :: a_module_t_sub statement and there is no module-level private statement, this call does not appear in the program's call-graph (the call-graph is not even generated in this case because it's the only procedure call).
This is at least partially fixed in #539. "Called-by" graphs are not yet generated for type-bound procedures, I will look into fixing that when I have time.
The FORD type-bound procedures public/private policy (discussed a bit here in issue #508) has ramifications for call-graph display of type-bound procedures.
First some example code:
When graphs are generated for this code, the publicly accessible type-bound procedure a_module_t_sub() is not displayed in the main program's call graph. In fact, because the program only has the type-bound procedure call, no call-graph is generated at all for the program. If there were other procedure calls in the program that FORD considers "fully" public, then the call-graph would be generated (minus the non fully public type-bound procedure).
The solution to this is the same as getting the type-bound procedures to be listed on the FORD Procedures main page list and the Procedures webpage. Add
at the module level of a_module (commented in above code).
So, as with the display of type-bound procedures in the FORD Procedures list and webpage, we are forced to modify our Fortran code just to get FORD to document it in a way that it seems FORD should be able do without the code change.
The text was updated successfully, but these errors were encountered: