summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2025-04-12 13:28:45 +0100
committerJoão Távora <joaotavora@gmail.com>2025-04-12 13:28:45 +0100
commit828fbddeb3145139f9d7eca4336f7c970a331d9d (patch)
tree6d4b5bc9f5946ac927cb268d9a18c66d216fb8c2
parente215ece289a533a38da5d326c895ac109a108639 (diff)
Fix beardbolt-preserve-library-functions switchexternals/beardbolt
It was broken from the beginning. * beardbolt.el (bb--process-asm): Fix.
-rw-r--r--beardbolt.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/beardbolt.el b/beardbolt.el
index fe70d93..e7899c0 100644
--- a/beardbolt.el
+++ b/beardbolt.el
@@ -382,10 +382,11 @@ some parts of the buffer and setup a buffer-local value of
(defun bb--process-asm (main-file-name)
(let* ((used-labels (obarray-make))
(routines (make-hash-table :test #'equal))
+ (globals (make-hash-table :test #'equal))
main-file-tag
main-file-routines
source-linum
- current-routine
+ current-global
reachable-label
(preserve-comments (bb--get bb-preserve-comments))
(preserve-unused-labels (bb--get bb-preserve-unused-labels))
@@ -393,29 +394,31 @@ some parts of the buffer and setup a buffer-local value of
(bb--sweeping ; first pass
((not (eq (char-after) ?\t))
(cond ((match bb-label-start)
- (unless (eq :notfound (gethash (match-string 1) routines :notfound))
- (setq current-routine (match-string 1)))
+ (unless (eq :notfound (gethash (match-string 1) globals :notfound))
+ (setq current-global (match-string 1)))
:preserve)
(t :kill)))
(t
- (cond ((and current-routine (match bb-has-opcode))
+ (cond ((and current-global (match bb-has-opcode))
+ (when (eq :notfound (gethash current-global routines :notfound))
+ (puthash current-global nil routines))
(while (match bb-label-reference)
- (push (match-string 0) (gethash current-routine routines)))
+ (push (match-string 0) (gethash current-global routines)))
:preserve)
((and (not preserve-comments) (match bb-comment-only))
:kill)
((match bb-defines-global bb-defines-function-or-object)
- (puthash (match-string 1) nil routines))
+ (puthash (match-string 1) nil globals))
((and (match bb-source-file-hint)
(equal (or (match-string 3) (match-string 2))
main-file-name))
(setq main-file-tag (match-string 1)))
((match bb-source-tag)
- (when (and current-routine
+ (when (and current-global
(equal (match-string 1) main-file-tag))
- (push current-routine main-file-routines))
+ (push current-global main-file-routines))
:preserve)
- ((match bb-endblock) (setq current-routine nil) :preserve)
+ ((match bb-endblock) (setq current-global nil) :preserve)
(t :preserve))))
(dolist (mfr (if preserve-library-functions
(hash-table-keys routines)