Diff on optionsets

This commit is contained in:
Benson Chu 2024-09-12 10:50:01 -05:00
parent d7396a1f91
commit 3eaf8aac76

View file

@ -111,7 +111,19 @@
(cdr compilation-arguments)))
(call-interactively #'recompile)))))
(defun ll/diff-c-on-two-compilations (file action)
(defun ll/diff-on-optionset (file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action))
(extra-option (read-string "Extra option? "))
(pipe (if (y-or-n-p "Diff assembly (y) or debug (n)? ")
">" "2>")))
(when (save-window-excursion
(not
(and (zerop (shell-command (format "%s %s /tmp/no-option.asm" comm pipe)))
(zerop (shell-command (format "%s %s %s /tmp/yes-option.asm" comm extra-option pipe))))))
(error "One of the commands failed"))
(ediff-files "/tmp/no-option.asm" "/tmp/yes-option.asm")))
(defun ll/diff-on-compiler (file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action))
(second-command (ll/build-clang-command (lls/un-trampify file) action))
(pipe (if (y-or-n-p "Diff assembly (y) or debug (n)? ")
@ -123,6 +135,13 @@
(error "One of the commands failed"))
(ediff-files "/tmp/old.asm" "/tmp/new.asm")))
(defun ll/diff-c-on-two-compilations (file action)
(let ((choice (read-char "Diff compiler versions (v) or diff options (o)? ")))
(pcase choice
(?v (ll/diff-on-compiler file action))
(?o (ll/diff-on-optionset file action))
(_ (error "Invalid choice")))))
(defun ll/act-on-c-file (file)
(let* ((action (aml/read-action-map ll/c-file-action-map)))
(if (eq action 'diff)