build: Use '-Wshadowed-toplevel' only when supported.
* guix/build/compile.scm (supported-warning-type?): New procedure. (%warnings): Remove 'unsupported-warning', though removing it doesn't make any difference. Define 'optional', and use it to determine whether to include 'shadowed-toplevel'.
This commit is contained in:
parent
6cf63fe887
commit
e429566fbb
|
@ -18,6 +18,7 @@
|
||||||
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
(define-module (guix build compile)
|
(define-module (guix build compile)
|
||||||
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
#:use-module (ice-9 threads)
|
#:use-module (ice-9 threads)
|
||||||
|
@ -58,13 +59,23 @@
|
||||||
((kw _ rest ...)
|
((kw _ rest ...)
|
||||||
(loop rest `(#f ,kw ,@result))))))
|
(loop rest `(#f ,kw ,@result))))))
|
||||||
|
|
||||||
|
(define (supported-warning-type? type)
|
||||||
|
"Return true if TYPE, a symbol, denotes a supported warning type."
|
||||||
|
(find (lambda (warning-type)
|
||||||
|
(eq? type (warning-type-name warning-type)))
|
||||||
|
%warning-types))
|
||||||
|
|
||||||
(define %warnings
|
(define %warnings
|
||||||
;; FIXME: 'format' is missing because it reports "non-literal format
|
;; FIXME: 'format' is missing because it reports "non-literal format
|
||||||
;; strings" due to the fact that we use 'G_' instead of '_'. We'll need
|
;; strings" due to the fact that we use 'G_' instead of '_'. We'll need
|
||||||
;; help from Guile to solve this.
|
;; help from Guile to solve this.
|
||||||
'(unsupported-warning unbound-variable arity-mismatch
|
(let ((optional (lambda (type)
|
||||||
|
(if (supported-warning-type? type)
|
||||||
|
(list type)
|
||||||
|
'()))))
|
||||||
|
`(unbound-variable arity-mismatch
|
||||||
macro-use-before-definition ;new in 2.2
|
macro-use-before-definition ;new in 2.2
|
||||||
shadowed-toplevel)) ;new in 2.2.5
|
,@(optional 'shadowed-toplevel)))) ;new in 2.2.5
|
||||||
|
|
||||||
(define (optimization-options file)
|
(define (optimization-options file)
|
||||||
"Return the default set of optimizations options for FILE."
|
"Return the default set of optimizations options for FILE."
|
||||||
|
|
Loading…
Reference in New Issue