[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Always write file when -emit-inline-file given
From: |
megane |
Subject: |
[PATCH] Always write file when -emit-inline-file given |
Date: |
Fri, 21 Aug 2020 10:39:16 +0300 |
User-agent: |
mu4e 1.0; emacs 26.3 |
Hi folks,
Here's a signed version of Alice's patch.
I agree with the reasoning completely. And I don't think the small bit
of extra clutter in limited cases is a big deal at all.
>From 652aac85ba17972441cc7cec98ae56088cb97257 Mon Sep 17 00:00:00 2001
From: alice maz <alice@alicemaz.com>
Date: Sat, 15 Aug 2020 13:43:16 -0500
Subject: [PATCH] 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.
---
support.scm | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
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)))))
--
2.17.1
- [PATCH] Always write file when -emit-inline-file given,
megane <=