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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
|
! RUN: %S/test_modfile.sh %s %t %f18
! Check modfile generation for generic interfaces
module m1
interface foo
real function s1(x,y)
real, intent(in) :: x
logical, intent(in) :: y
end function
complex function s2(x,y)
complex, intent(in) :: x
logical, intent(in) :: y
end function
end interface
generic :: operator ( + ) => s1, s2
interface operator ( /= )
logical function f1(x, y)
real, intent(in) :: x
logical, intent(in) :: y
end function
end interface
interface
logical function f2(x, y)
complex, intent(in) :: x
logical, intent(in) :: y
end function
logical function f3(x, y)
integer, intent(in) :: x
logical, intent(in) :: y
end function
end interface
generic :: operator(.ne.) => f2
generic :: operator(<>) => f3
private :: operator( .ne. )
interface bar
procedure :: s1
procedure :: s2
procedure :: s3
procedure :: s4
end interface
interface operator( .bar.)
procedure :: s1
procedure :: s2
procedure :: s3
procedure :: s4
end interface
contains
logical function s3(x,y)
logical, intent(in) :: x,y
end function
integer function s4(x,y)
integer, intent(in) :: x,y
end function
end
!Expect: m1.mod
!module m1
! interface foo
! procedure::s1
! procedure::s2
! end interface
! interface
! function s1(x,y)
! real(4),intent(in)::x
! logical(4),intent(in)::y
! real(4)::s1
! end
! end interface
! interface
! function s2(x,y)
! complex(4),intent(in)::x
! logical(4),intent(in)::y
! complex(4)::s2
! end
! end interface
! interface operator(+)
! procedure::s1
! procedure::s2
! end interface
! interface operator(/=)
! procedure::f1
! procedure::f2
! procedure::f3
! end interface
! private::operator(/=)
! interface
! function f1(x,y)
! real(4),intent(in)::x
! logical(4),intent(in)::y
! logical(4)::f1
! end
! end interface
! interface
! function f2(x,y)
! complex(4),intent(in)::x
! logical(4),intent(in)::y
! logical(4)::f2
! end
! end interface
! interface
! function f3(x,y)
! integer(4),intent(in)::x
! logical(4),intent(in)::y
! logical(4)::f3
! end
! end interface
! interface bar
! procedure::s1
! procedure::s2
! procedure::s3
! procedure::s4
! end interface
! interface operator(.bar.)
! procedure::s1
! procedure::s2
! procedure::s3
! procedure::s4
! end interface
!contains
! function s3(x,y)
! logical(4),intent(in)::x
! logical(4),intent(in)::y
! logical(4)::s3
! end
! function s4(x,y)
! integer(4),intent(in)::x
! integer(4),intent(in)::y
! integer(4)::s4
! end
!end
module m1b
use m1
end
!Expect: m1b.mod
!module m1b
! use m1,only:foo
! use m1,only:s1
! use m1,only:s2
! use m1,only:operator(+)
! use m1,only:f1
! use m1,only:f2
! use m1,only:f3
! use m1,only:bar
! use m1,only:operator(.bar.)
! use m1,only:s3
! use m1,only:s4
!end
module m1c
use m1, only: myfoo => foo
use m1, only: operator(.bar.)
use m1, only: operator(.mybar.) => operator(.bar.)
use m1, only: operator(+)
end
!Expect: m1c.mod
!module m1c
! use m1,only:myfoo=>foo
! use m1,only:operator(.bar.)
! use m1,only:operator(.mybar.)=>operator(.bar.)
! use m1,only:operator(+)
!end
module m2
interface foo
procedure foo
end interface
contains
complex function foo()
foo = 1.0
end
end
!Expect: m2.mod
!module m2
! interface foo
! procedure::foo
! end interface
!contains
! function foo()
! complex(4)::foo
! end
!end
module m2b
type :: foo
real :: x
end type
interface foo
end interface
private :: bar
interface bar
end interface
end
!Expect: m2b.mod
!module m2b
! interface foo
! end interface
! type::foo
! real(4)::x
! end type
! interface bar
! end interface
! private::bar
!end
! Test interface nested inside another interface
module m3
interface g
subroutine s1(f)
interface
real function f(x)
interface
subroutine x()
end subroutine
end interface
end function
end interface
end subroutine
end interface
end
!Expect: m3.mod
!module m3
! interface g
! procedure::s1
! end interface
! interface
! subroutine s1(f)
! interface
! function f(x)
! interface
! subroutine x()
! end
! end interface
! real(4)::f
! end
! end interface
! end
! end interface
!end
module m4
interface foo
integer function foo()
end function
integer function f(x)
end function
end interface
end
subroutine s4
use m4
i = foo()
end
!Expect: m4.mod
!module m4
! interface foo
! procedure::foo
! procedure::f
! end interface
! interface
! function foo()
! integer(4)::foo
! end
! end interface
! interface
! function f(x)
! real(4)::x
! integer(4)::f
! end
! end interface
!end
! Compile contents of m4.mod and verify it gets the same thing again.
module m5
interface foo
procedure::foo
procedure::f
end interface
interface
function foo()
integer(4)::foo
end
end interface
interface
function f(x)
integer(4)::f
real(4)::x
end
end interface
end
!Expect: m5.mod
!module m5
! interface foo
! procedure::foo
! procedure::f
! end interface
! interface
! function foo()
! integer(4)::foo
! end
! end interface
! interface
! function f(x)
! real(4)::x
! integer(4)::f
! end
! end interface
!end
module m6a
interface operator(<)
logical function lt(x, y)
logical, intent(in) :: x, y
end function
end interface
end
!Expect: m6a.mod
!module m6a
! interface operator(<)
! procedure::lt
! end interface
! interface
! function lt(x,y)
! logical(4),intent(in)::x
! logical(4),intent(in)::y
! logical(4)::lt
! end
! end interface
!end
module m6b
use m6a, only: operator(.lt.)
end
!Expect: m6b.mod
!module m6b
! use m6a,only:operator(.lt.)
!end
|