emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/beardbolt 9b1a5abbdf 208/323: Strip -flto flag from com


From: ELPA Syncer
Subject: [elpa] externals/beardbolt 9b1a5abbdf 208/323: Strip -flto flag from compile_commands.json by default
Date: Thu, 9 Mar 2023 10:58:31 -0500 (EST)

branch: externals/beardbolt
commit 9b1a5abbdf461e6d4bfee50f71e3c85d00da1c0c
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>

    Strip -flto flag from compile_commands.json by default
    
    It seems like (useful) assembly information is not generated in lto
    mode, so we'll try compiling without -flto if it is there in
    compile_commands.json. This shouldn't affect passing in -flto
    manually.
---
 rmsbolt-split.el           | 11 +++++++----
 rmsbolt.el                 |  2 ++
 test/rmsbolt-split-test.el |  4 ++++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/rmsbolt-split.el b/rmsbolt-split.el
index 1fdfc50aab..b469ab888a 100644
--- a/rmsbolt-split.el
+++ b/rmsbolt-split.el
@@ -41,12 +41,15 @@
 
 ;;; Code:
 
-(defun rmsbolt-split-rm-single (cmd flag)
-  "Remove a single FLAG from CMD."
-  (let ((cmd (split-string cmd rmsbolt-split--regexp)))
+(defun rmsbolt-split-rm-single (cmd flag &optional comparator)
+  "Remove a single FLAG from CMD.
+
+Optionally compares using COMPARATOR."
+  (let ((cmd (split-string cmd rmsbolt-split--regexp))
+        (comparator (or comparator #'string=)))
     (mapconcat
      #'identity
-     (cl-remove-if (apply-partially #'string= flag) cmd)
+     (cl-remove-if (apply-partially comparator flag) cmd)
      " ")))
 
 (defun rmsbolt-split-rm-double (cmd flag)
diff --git a/rmsbolt.el b/rmsbolt.el
index 6e174e5db3..cc4115f85d 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -805,9 +805,11 @@ return t if successful."
       (setq-local rmsbolt-command
                   ;; Remove -c, -S, and -o <arg> if present,
                   ;; as we will add them back
+                  ;; Remove args starting with -flto, as -flto breaks asm 
output.
                   (thread-first (cl-second to-ret)
                     (rmsbolt-split-rm-single "-c")
                     (rmsbolt-split-rm-single "-S")
+                    (rmsbolt-split-rm-single "-flto" #'string-prefix-p)
                     (rmsbolt-split-rm-double "-o")))
       t)))
 ;;;; Language Definitions
diff --git a/test/rmsbolt-split-test.el b/test/rmsbolt-split-test.el
index c8e15afcb2..6165beb7fa 100644
--- a/test/rmsbolt-split-test.el
+++ b/test/rmsbolt-split-test.el
@@ -33,6 +33,10 @@
            (rmsbolt-split-rm-single "/usr/bin/c++ -a -R -a" "-a")
            "/usr/bin/c++ -R"))
 
+  (should (equal
+           (rmsbolt-split-rm-single "/usr/bin/c++ -a -R -c -flto=thin" "-flto" 
#'string-prefix-p)
+           "/usr/bin/c++ -a -R -c"))
+
   (should (equal
            (rmsbolt-split-rm-single
             "/usr/bin/c++   -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB 
-DQT_NO_KEYWORDS -DQT_WIDGETS_LIB -Isrc/googletest/include -I../common -Icommon 
-Icommon/protobuf -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtCore -isystem 
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem 
/usr/include/x86_64-linux-gnu/qt5/QtGui   -Werror=retu [...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]