Issue #365 - Fix regression w/c-compiler-options

This commit is contained in:
Justin Ethier 2022-06-26 18:42:22 -04:00
parent 4629bb3911
commit 1404d374d3
2 changed files with 23 additions and 3 deletions

View file

@ -9,6 +9,7 @@ Features
Bug Fixes
- Fix a regression where `c-compiler-options` was not recognized as a top level form by programs.
- Enforce a maximum recursion depth when printing an object via `display` and `write`, and when comparing objects via `equal?`. This prevents segmentation faults when working with circular data structures.
## 0.34.0 - January 2, 2022

View file

@ -723,7 +723,7 @@
in-prog))
;; Compile and emit:
(define (run-compiler args append-dirs prepend-dirs)
(define (run-compiler args append-dirs prepend-dirs change-cc-opts!)
(let* ((in-file (car args))
(expander (base-expander))
(in-prog-raw (read-file in-file))
@ -745,6 +745,20 @@
(not (null? (car program:imports/code))))
(lib:get-all-import-deps (car program:imports/code) append-dirs prepend-dirs expander)
'()))
;; Read C compiler options
(cc-opts
(cond
(program?
(let ((opts (program-c-compiler-opts! in-prog)))
(when (not (null? opts))
(change-cc-opts! opts))
(string-join ;; Check current program for options
opts
" ")))
(else
(string-join
(lib:c-compiler-options (car in-prog))
" "))))
;; Read all linker options from dependent libs
(c-linker-options
(let ((lib-options (lib:get-all-c-linker-options lib-deps append-dirs prepend-dirs expander)))
@ -1132,13 +1146,18 @@ Debug options:
(cond
(run-scm-compiler?
;; Compile Scheme code into a C file
(run-compiler non-opts append-dirs prepend-dirs))
(run-compiler non-opts append-dirs prepend-dirs
(lambda (opts)
(set! cc-opts opts))))
(else
;; Generate the C file
(cond
(no-compiler-subprocess
;; Special case, we can generate .C file within this process
(run-compiler non-opts append-dirs prepend-dirs))
(run-compiler non-opts append-dirs prepend-dirs
(lambda (opts) (set! cc-opts opts)))
)
(else
;; Normal path is to run another instance of cyclone to generate
;; the .C file. This lets us immediately free those resources once