-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwarnings.f90
34 lines (34 loc) · 997 Bytes
/
warnings.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module m
private
contains
subroutine hello() ! private subroutine not called in module
print*,"hello"
end subroutine hello
end module m
!
program main
use m
implicit none
integer :: i,j ! j is not used
real, parameter :: pi = 3.14159 ! pi is not used
i = 2
print*,i
end program main
! output of gfortran -Werror=unused-variable -Werror=unused-parameter \
! -Werror=unused-function warnings.f90
! warnings.f90:12:14:
!
! 12 | integer :: i,j ! j is not used
! | 1
! Error: Unused variable 'j' declared at (1) [-Werror=unused-variable]
! warnings.f90:13:21:
!
! 13 | real, parameter :: pi = 3.14159
! | 1
! Error: Unused parameter 'pi' declared at (1) [-Werror=unused-parameter]
! warnings.f90:4:16:
!
! 4 | subroutine hello() ! private subroutine not called in module
! | ^
! Error: 'hello' defined but not used [-Werror=unused-function]
! f951.exe: some warnings being treated as errors