summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-11-19 14:21:58 +0530
committerZubin Duggal <zubin.duggal@gmail.com>2022-03-30 17:01:11 +0530
commit079be2c88032e2551c356bee273c301b29281135 (patch)
treec4dfcec53f77ea93d78563004ad3b38475b60ddb /docs
parent21894a6318e0daffa0e34041855c3c73ad1f5b6f (diff)
downloadhaskell-wip/parse-errs.tar.gz
Add warnings for file header pragmas that appear in the body of a module (#20385)wip/parse-errs
Once we are done parsing the header of a module to obtain the options, we look through the rest of the tokens in order to determine if they contain any misplaced file header pragmas that would usually be ignored, potentially resulting in bad error messages. The warnings are reported immediately so that later errors don't shadow over potentially helpful warnings. Metric Increase: T13719
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/using-warnings.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 9eaf63ed80..cb95ffb263 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -456,6 +456,20 @@ of ``-W(no-)*``.
recognises pragmas known to be used by other tools, e.g.
``OPTIONS_HUGS`` and ``DERIVE``.
+.. ghc-flag:: -Wmisplaced-pragmas
+ :shortdesc: warn about uses of file header pragmas in the module body
+ :type: dynamic
+ :reverse: -Wno-misplaced-pragmas
+ :category:
+
+ :since: 9.4
+
+ :default: on
+
+ Warn when a pragma that should only appear in the header of a module,
+ such as a `LANGUAGE` or `OPTIONS_GHC` pragma, appears in the body of
+ the module instead.
+
.. ghc-flag:: -Wmissed-specialisations
:shortdesc: warn when specialisation of an imported, overloaded function
fails.