mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
Omit C meaningless expressions
When compiling Cyc-seq expressions there are cases where the generated C code would have no effect. Just omit it in this case to prevent a warning from the C compiler.
This commit is contained in:
parent
856f201eb0
commit
89c58f8b44
1 changed files with 9 additions and 3 deletions
|
@ -828,11 +828,17 @@
|
|||
((equal? 'Cyc-seq fun)
|
||||
(let ((exps (foldr
|
||||
(lambda (expr acc)
|
||||
;(c:append
|
||||
(let ((cp1 (c-compile-exp expr append-preamble cont trace cps?))
|
||||
;; Join expressions; based on c:append
|
||||
(let ((cp1 (if (ref? expr)
|
||||
; Ignore lone ref to avoid C warning
|
||||
(c-code/vars "" '())
|
||||
(c-compile-exp expr append-preamble cont trace cps?)))
|
||||
(cp2 acc))
|
||||
(c-code/vars
|
||||
(string-append (c:body cp1) ";" (c:body cp2))
|
||||
(let ((cp1-body (c:body cp1)))
|
||||
(if (zero? (string-length cp1-body))
|
||||
(c:body cp2) ;; Ignore cp1 if necessary
|
||||
(string-append cp1-body ";" (c:body cp2))))
|
||||
(append (c:allocs cp1) (c:allocs cp2)))))
|
||||
(c-code "")
|
||||
args)))
|
||||
|
|
Loading…
Add table
Reference in a new issue