mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Issue #455 - Avoid generating C code containing unused variables
This commit is contained in:
parent
26cd116cb8
commit
1187d7fab1
2 changed files with 15 additions and 4 deletions
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## TBD
|
||||
|
||||
Bug Fixes
|
||||
|
||||
- Avoid generating C code containing unused variables. In addition to generating better code this also prevents the C compiler from raising associated warnings.
|
||||
|
||||
## 0.28.0 - April 8, 2021
|
||||
|
||||
Features
|
||||
|
|
|
@ -1299,10 +1299,15 @@
|
|||
(let ((exps (foldr
|
||||
(lambda (expr acc)
|
||||
;; 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 ast-id trace cps?)))
|
||||
(let ((cp1 (cond
|
||||
((ref? expr)
|
||||
;; Ignore lone ref to avoid C warning
|
||||
(c:code/vars "" '()))
|
||||
((tagged-list? '%closure expr)
|
||||
;; Discard unused func and avoid C warning
|
||||
(c:code/vars "" '()))
|
||||
(else
|
||||
(c-compile-exp expr append-preamble cont ast-id trace cps?))))
|
||||
(cp2 acc))
|
||||
(c:code/vars
|
||||
(let ((cp1-body (c:body cp1)))
|
||||
|
|
Loading…
Add table
Reference in a new issue