summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/language/tree-il/analyze.scm5
-rw-r--r--module/scripts/compile.scm10
-rw-r--r--module/system/base/compile.scm13
3 files changed, 10 insertions, 18 deletions
diff --git a/module/language/tree-il/analyze.scm b/module/language/tree-il/analyze.scm
index 7b5612bcf..c63d161be 100644
--- a/module/language/tree-il/analyze.scm
+++ b/module/language/tree-il/analyze.scm
@@ -1098,10 +1098,7 @@ resort, return #t when EXP refers to the global variable SPECIAL-NAME."
#(format 1 ,format-analysis)))
(define (make-analyzer warning-level warnings)
- (define (enabled-for-level? level)
- (match warning-level
- ((? boolean?) warning-level)
- ((? exact-integer?) (>= warning-level level))))
+ (define (enabled-for-level? level) (<= level warning-level))
(let ((analyses (filter-map (match-lambda
(#(kind level analysis)
(and (or (enabled-for-level? level)
diff --git a/module/scripts/compile.scm b/module/scripts/compile.scm
index ea6377b48..7b6daea85 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -87,12 +87,6 @@
("help"
(show-warning-help)
(exit 0))
- ("all"
- (alist-cons 'warning-level #t
- (alist-delete 'warning-level result)))
- ("none"
- (alist-cons 'warning-level #f
- (alist-delete 'warning-level result)))
((? string->number)
(let ((n (string->number arg)))
(unless (and (exact-integer? n) (<= 0 n))
@@ -176,8 +170,8 @@ There is NO WARRANTY, to the extent permitted by law.~%"))
(warning-type-description wt)))
%warning-types)
(format #t "~%")
- (format #t "You may also specify warning levels as `-Wnone', `-W0`, `-W1',~%")
- (format #t "`-W2', `-W3', or `-Wall`. The default is `-W1'.~%"))
+ (format #t "You may also specify warning levels as `-W0`, `-W1',~%")
+ (format #t "`-W2', or `-W3'. The default is `-W1'.~%"))
(define (show-optimization-help)
(format #t "The available optimizations are:~%~%")
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)))))