~ chicken-core (chicken-5) 5df4ce1939c7450dfa481172204b6c898505e7a5
commit 5df4ce1939c7450dfa481172204b6c898505e7a5 Author: alice maz <alice@alicemaz.com> AuthorDate: Sat Aug 15 13:43:16 2020 -0500 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Fri Aug 21 10:52:06 2020 +0200 Always write file when -emit-inline-file given Presently, -emit-inline-file will not emit a file, and will delete one if it exists, if there are no exported procedures that can be inlined. This means in a pattern where you always emit for every -unit, and always consult for every -uses, compilation will halt if a file isn't found. It's a matter of opinion what the right thing to do here is, but I'm inclined to think a file should always be emitted if the flag is passed, even it's empty, because: - It's consistent with how -emit-types-file behaves - Usage of the flag indicates user intent to create the file "absence of evidence isn't evidence of absence"--the existence of an empty file is an affirmative - Statement there is nothing to inline Note the deletion/omission behavor was added on purpose in 2010, so this isn't accidental, but I'm not sure the reasoning. Fixes #1715 Signed-off-by: megane <meganeka@gmail.com> - I copied the rationale from the Trac issue page. Signed-off-by: felix <felix@call-with-current-continuation.org> diff --git a/support.scm b/support.scm index 5eff6e23..f610349d 100644 --- a/support.scm +++ b/support.scm @@ -841,18 +841,16 @@ (set! lst (cons sym lst)) (set! out (cons (list sym (node->sexpr (cdr val))) out))))) db) - (if (null? out) - (delete-file* inline-file) - (with-output-to-file inline-file - (lambda () - (print "; GENERATED BY CHICKEN " (chicken-version) " FROM " - source-file "\n") - (for-each - (lambda (x) - (pp x) - (newline)) - (reverse out)) - (print "; END OF FILE")))) + (with-output-to-file inline-file + (lambda () + (print "; GENERATED BY CHICKEN " (chicken-version) " FROM " + source-file "\n") + (for-each + (lambda (x) + (pp x) + (newline)) + (reverse out)) + (print "; END OF FILE"))) (when (and (pair? lst) (debugging 'i "the following procedures can be globally inlined:")) (for-each (cut print " " <>) (sort-symbols lst)))))Trap