summaryrefslogtreecommitdiff
path: root/module/system
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2020-05-08 16:32:40 +0200
committerAndy Wingo <wingo@pobox.com>2020-05-08 16:35:04 +0200
commite9c0f3071dedb0f6b39757e920cdc182435c8725 (patch)
tree4b1117f8ab107fa274ee9c1ff01fabdaf0aee67e /module/system
parent220934c49d2629ebf826cc377541694334f44e7e (diff)
downloadguile-e9c0f3071dedb0f6b39757e920cdc182435c8725.tar.gz
Warning and optimization levels always small integers
* module/language/tree-il/analyze.scm (make-analyzer): Expect an int for optimization level. * module/scripts/compile.scm (%options, show-warning-help): No more -Wnone / Wall; use -W0 or -W9 instead. * module/system/base/compile.scm (level-validator): Validate small int. (compute-analyzer, add-default-optimizations): Likewise. * test-suite/tests/optargs.test (without-compiler-warnings): * test-suite/tests/tree-il.test (call-with-warnings): Parameterize level to 0, not #f. * bootstrap/Makefile.am (GUILE_WARNINGS): Use -W0, not -Wnone.
Diffstat (limited to 'module/system')
-rw-r--r--module/system/base/compile.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index 8ffbb294f..7ec2da3c2 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -34,12 +34,11 @@
(define (level-validator x)
- (match x
- ((? boolean?) x)
- ((and (? exact-integer?) (not (? negative?))) x)
- (_ (error
- "bad warning or optimization level: expected #f, #t, or integer >= 0"
- x))))
+ (unless (and (exact-integer? x) (<= 0 x 9))
+ (error
+ "bad warning or optimization level: expected integer between 0 and 9"
+ x))
+ x)
(define default-warning-level (make-parameter 1 level-validator))
(define default-optimization-level (make-parameter 2 level-validator))
@@ -215,6 +214,7 @@
;;;
(define (compute-analyzer lang warning-level opts)
+ (level-validator warning-level)
(match (language-analyzer lang)
(#f (lambda (exp env) (values)))
(proc (proc warning-level
@@ -225,6 +225,7 @@
((_ _ . opts) (lp opts))))))))
(define (add-default-optimizations lang optimization-level opts)
+ (level-validator optimization-level)
(match (language-optimizations-for-level lang)
(#f opts)
(get-opts (append opts (get-opts optimization-level)))))