add -fwarn-dodgy-foreign-imports (see #1357)
authorSimon Marlow <marlowsd@gmail.com>
Wed, 9 Jul 2008 10:21:43 +0000 (10:21 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Wed, 9 Jul 2008 10:21:43 +0000 (10:21 +0000)
commit3b6382e443ed57d08dc676337621fc3d5cd0cb05
tree7e07abd1c3433a87199a1379659728741d795bd5
parent0c266d7ac54ae27e693ef04e4679220a32da0694
add -fwarn-dodgy-foreign-imports (see #1357)

From the entry in the User's guide:

-fwarn-dodgy-foreign-imports causes a warning to be emitted for
foreign imports of the following form:

foreign import "f" f :: FunPtr t

on the grounds that it probably should be

foreign import "&f" f :: FunPtr t

The first form declares that `f` is a (pure) C function that takes no
arguments and returns a pointer to a C function with type `t`, whereas
the second form declares that `f` itself is a C function with type
`t`.  The first declaration is usually a mistake, and one that is hard
to debug because it results in a crash, hence this warning.
compiler/main/DynFlags.hs
compiler/typecheck/TcForeign.lhs
compiler/typecheck/TcType.lhs
docs/users_guide/using.xml