"no output will be generated" should be an error, not a warning.
Consider a file "Test.hs" which has a "main" function but is declared as "module Test where..."
If we attempt to compile it with for example "ghc --make Test.hs -o Test", we get the following warning:
Warning: output was redirected with -o, but no output will be generated because there is no Main module.
This should be upgraded from a warning to an error. This would help e.g. Cabal, because such warnings do not lead to a failure of the wrapping Cabal process, which is confusing to end-users.
For gory details, see e.g. discussion at https://github.com/haskell/cabal/issues/1847