[GHC] #9037: Add option to make selected warnings errors

GHC ghc-devs at haskell.org
Sat Apr 26 07:13:10 UTC 2014


#9037: Add option to make selected warnings errors
-------------------------------------+------------------------------------
        Reporter:  nh2               |            Owner:
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by schyler):

 The rust compiler has a nice system where you don't need tons and tons of
 flags for warnings/errors/ignores.

 For example:
 {{{
 Kyles-iMac:~ kvanb$ rustc -W

 Available lint options:
     -W <foo>           Warn about <foo>
     -A <foo>           Allow <foo>
     -D <foo>           Deny <foo>
     -F <foo>           Forbid <foo> (deny, and deny all overrides)


 Available lint checks:

                              name  default  meaning
                              ----  -------  -------

              non-camel-case-types  allow    types, variants and traits
 should have camel case names
               managed-heap-memory  allow    use of managed (@ type) heap
 memory
                 owned-heap-memory  allow    use of owned (~ type) heap
 memory
                          unstable  allow    detects use of #[unstable]
 items (incl. items with no stability attribute)
                       heap-memory  allow    use of any (~ type or @ type)
 heap memory
         unnecessary-qualification  allow    detects unnecessarily
 qualified names
             non-uppercase-statics  allow    static constants should have
 uppercase identifiers
                       missing-doc  allow    detects missing documentation
 for public members
                      unsafe-block  allow    usage of an `unsafe` block
                  unreachable-code  warn     detects unreachable code
                        deprecated  warn     detects use of #[deprecated]
 items
                    unused-imports  warn     imports that are never used
                          warnings  warn     mass-change the level for
 lints which produce warnings
                    path-statement  warn     path statements with no effect
                            ctypes  warn     proper use of std::libc types
 in foreign modules
                   dead-assignment  warn     detect assignments that will
 never be read
                     unused-unsafe  warn     unnecessary use of an `unsafe`
 block
                        unused-mut  warn     detect mut variables which
 don't need to be mutable
     non-uppercase-pattern-statics  warn     static constants in match
 patterns should be all caps
                 unrecognized-lint  warn     unrecognized lint attribute
                   unused-variable  warn     detect variables which are not
 used in any way
                         dead-code  warn     detect piece of code that will
 never be used
            unnecessary-allocation  warn     detects unnecessary
 allocations that can be eliminated
                   attribute-usage  warn     detects bad use of attributes
                     type-overflow  warn     literal out of range for its
 type
                       type-limits  warn     comparisons made useless by
 limits of the types involved
                        while-true  warn     suggest using loop { } instead
 of while(true) { }
                      experimental  warn     detects use of #[experimental]
 items
                  unknown-features  deny     unknown features found in
 create-level #[feature] directives

 }}}

 Maybe a long term goal might be to build something similar-ish. Just a
 thought.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9037#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list