[Fortran-Experiments]: patch for error checking on binding labels and derived types, etc.
Christopher D. Rickett
crickett@lanl.gov
Tue Feb 27 19:38:00 GMT 2007
>
> I didn't add a test case yet, because there is one missing warning and
> one wrong warning:
> -----------------------------------
> ! { dg-do "compile" }
> ! Dummy arguments which are functions are allowed to have
> ! the Bind(c) flag set.
>
> MODULE OpenGL_glut
> IMPLICIT NONE
>
> ! Notes:
> ! (1) gives the wrong warning: "Variable 'func' is a parameter to the
> ! BIND(C) procedure 'glutcreatemenu' but may not be C interoperable"
> ! (2) gives no warning although integer has no C interop. kind.
>
> INTERFACE
> FUNCTION glutCreateMenu(func) BIND(C,NAME="glutCreateMenu")
> use iso_c_binding ! ^^^^<<<<< (1)
> INTEGER :: glutCreateMenu ! <<<<<<<< (2)
> INTERFACE ! The dummy argument 'func'
> SUBROUTINE func() BIND(C) ! is allowed to have the bind(c) flag set
> END SUBROUTINE func
> END INTERFACE
> END FUNCTION glutCreateMenu
> END INTERFACE
> END MODULE OpenGL_glut
>
> ! { dg-final { cleanup-modules "OpenGL_glut" } }
> -----------------------------------
>
i moved the verification of bind(c) procedures to resolve_fl_procedure, and
i put the verification of the parameters there also. now, the above code
reports:
tobias9.f03:10.25:
FUNCTION glutCreateMenu(func) BIND(C,NAME="glutCreateMenu")
1
Warning: Variable 'glutcreatemenu' at (1) may not be a C interoperable
kind but it is bind(c)
i've also created a new test case that tests interfaces and contained
procedures to make sure they're caught with the testing in the new place.
i'll include it in my next patch soon.
Chris
More information about the Fortran
mailing list