Fix bug in parsing of cond-expand.
authorChris Hanson <org/chris-hanson/cph>
Mon, 18 Nov 2019 00:35:53 +0000 (16:35 -0800)
committerChris Hanson <org/chris-hanson/cph>
Mon, 18 Nov 2019 00:35:53 +0000 (16:35 -0800)
src/runtime/mit-macros.scm

index 72eed2cb19a1ad2bb8e04afb724c8b2329adfec2..0f4c88076d753f7c5667f9079b00ebaae787d2c0 100644 (file)
@@ -708,10 +708,12 @@ USA.
      (scons-rule `((value id=?)
                   (* (subform (cons ,(feature-requirement-pattern)
                                     (* any))))
-                  (opt (subform (cons (keep-if id=? else)
-                                      (* any)))))
-       (lambda (id=? clauses)
-        (apply scons-begin (evaluate-cond-expand id=? clauses)))))))
+                  (or (subform (ignore-if id=? else)
+                               (* any))
+                      (value '())))
+       (lambda (id=? clauses else-forms)
+        (apply scons-begin
+               (evaluate-cond-expand id=? clauses else-forms)))))))
 
 (define (feature-requirement-pattern)
   (spar-pattern-fixed-point
@@ -729,15 +731,14 @@ USA.
 (define (library-name-pattern)
   `(subform (* (or symbol ,exact-nonnegative-integer?))))
 
-(define (evaluate-cond-expand id=? clauses)
+(define (evaluate-cond-expand id=? clauses else-forms)
   (let ((clause
         (find (lambda (clause)
-                (or (id=? 'else (car clause))
-                    (evaluate-feature-requirement id=? (car clause))))
+                (evaluate-feature-requirement id=? (car clause)))
               clauses)))
     (if clause
        (cdr clause)
-       '())))
+       else-forms)))
 
 (define (evaluate-feature-requirement id=? feature-requirement)