... | ... | @@ -421,14 +421,9 @@ Once this is done, we should hopefully be able to rid ourselves of `defaultReaso |
|
|
|
|
|
# 7. Suppressed warnings
|
|
|
|
|
|
This section contains thoughts on improvements to the design to support more uniform suppression of warnings that the
|
|
|
user does not want. Note that this *builds on* the design above. It does *not* suggest a new alternative to the design above.
|
|
|
|
|
|
**EDIT: Design A triumphed. Expand the arrow to read the original write-up.**
|
|
|
|
|
|
<details><summary> Original write up </summary>
|
|
|
|
|
|
## Current design
|
|
|
## 7.1 Current design
|
|
|
|
|
|
Today, all code that creates a warning should check whether that warning is suppressed. Here is one representative example:
|
|
|
|
... | ... | @@ -442,7 +437,7 @@ Today, all code that creates a warning should check whether that warning is supp |
|
|
|
|
|
This code produces a warning that the monomorphism restriction has affect types. Note that it first checks whether `Opt_WarnMonomorphism` is enabled. Then, (maybe) it creates a warning with `WarningWithFlag Opt_WarnMonomorphism`. This is strage, because the code must interact with `Opt_WarnMonomorphism` *twice*: once to see whether the warnings should be generated at all, and again to mark the flag for the warning, which other code uses to determine whether the warning should be fatal (i.e. because of `-Werror`). This is error prone (every code that generates a warning must remember to make an extra check) and duplicative.
|
|
|
|
|
|
## The new disign
|
|
|
## 7.2 The new disign
|
|
|
|
|
|
We introduce a new `Severity` field:
|
|
|
|
... | ... | @@ -464,7 +459,7 @@ Now that we have the `Severity` field, we can remove the many places throughout |
|
|
|
|
|
A good way to approach this is simply to search for any occurrence of `Opt_Warn` in the code and remove extra conditionals.
|
|
|
|
|
|
## An alterantive design (not adopted)
|
|
|
## 7.3 An alterantive design (not adopted)
|
|
|
|
|
|
<details><summary> An atternative design </summary>
|
|
|
|
... | ... | |