LCOV - code coverage report
Current view: | top level - utils - cam_abortutils.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 3 | 6 | 50.0 %
Date: | 2025-01-13 21:54:50 |  | Functions: | 1 | 1 | 100.0 %

              Line data    Source code
           1             : module cam_abortutils
           2             :
           3             :    use shr_kind_mod, only: SHR_KIND_CL
           4             :    use shr_sys_mod,  only: endrun => shr_sys_abort
           5             :
           6             :    implicit none
           7             :    private
           8             :    save
           9             :
          10             :    public :: endrun
          11             :    public :: handle_allocate_error
          12             :
          13             : CONTAINS
          14             :
          15        1536 :    subroutine handle_allocate_error(retval, subname, fieldname)
          16             :       ! if <retval> is not zero, generate an error message and abort
          17             :       ! Dummy arguments
          18             :       integer,          intent(in) :: retval
          19             :       character(len=*), intent(in) :: subname
          20             :       character(len=*), intent(in) :: fieldname
          21             :       ! Local variable
          22             :       character(len=SHR_KIND_CL)   :: errmsg
          23             :
          24        1536 :       if (retval /= 0) then
          25           0 :          write(errmsg, '(4a,i0)') trim(subname), ' error allocating ',        &
          26           0 :               trim(fieldname), ', error = ', retval
          27           0 :          call endrun(errmsg)
          28             :       end if
          29        1536 :    end subroutine handle_allocate_error
          30             :
          31             : end module cam_abortutils

Generated by: LCOV version 1.14