Get warning about unused identifiers from use only

Viewed 106

Let's say I have the following code:

module test_mod
    implicit none
    private
    public :: A, B, double

    integer :: A, C
    integer, parameter :: B = 2

    contains

    integer elemental function double(n)
        integer, intent(in) :: n
        double = 2 * n
    end function
end module


program test_prog
    use test_mod, only: A, B, double
    implicit none

    A = 3
    write(*, *) A
end program

If I compile with gfortran -Wall -Wextra I correctly get warnings about:

  • Unused variable C in test_mod.
  • Imported but unused variable B in the program.

But I would like to also get a warning about the fact that double is imported, but unused. Is there a compiler option that I overlook? Is there a compiler that does this? Is it coming in later versions of gfortran? (I used 8.2.1)

0 Answers
Related