emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp 8f81859 3/5: Rework `comp-c-func-name' arguments


From: Andrea Corallo
Subject: feature/native-comp 8f81859 3/5: Rework `comp-c-func-name' arguments
Date: Thu, 2 Jul 2020 16:59:08 -0400 (EDT)

branch: feature/native-comp
commit 8f81859497b7dd0c537d24a27985a26ffc778a3a
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    Rework `comp-c-func-name' arguments
    
        * lisp/emacs-lisp/comp.el (comp-c-func-name): Add FIRST argument
        to ignore the compiler context and return the first name.
    
        * lisp/emacs-lisp/disass.el (disassemble-internal): Update the
        `comp-c-func-name' call.
---
 lisp/emacs-lisp/comp.el   | 8 +++++---
 lisp/emacs-lisp/disass.el | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 205966f..a16cf1d 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -566,9 +566,11 @@ instruction."
   (or (comp-spill-decl-spec function-name 'speed)
       comp-speed))
 
-(defun comp-c-func-name (name prefix)
+(defun comp-c-func-name (name prefix &optional first)
   "Given NAME return a name suitable for the native code.
-Put PREFIX in front of it."
+Add PREFIX in front of it.  If FIRST is not nil pick the first
+available name ignoring compilation context and potential name
+clashes."
   ;; Unfortunatelly not all symbol names are valid as C function names...
   ;; Nassi's algorithm here:
   (let* ((orig-name (if (symbolp name) (symbol-name name) name))
@@ -583,7 +585,7 @@ Put PREFIX in front of it."
                           "-" "_" orig-name))
          (human-readable (replace-regexp-in-string
                           (rx (not (any "0-9a-z_"))) "" human-readable)))
-    (if comp-ctxt
+    (if (null first)
         ;; Prevent C namespace conflicts.
         (cl-loop
          with h = (comp-ctxt-funcs-h comp-ctxt)
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el
index 82c8de6..aa8b248 100644
--- a/lisp/emacs-lisp/disass.el
+++ b/lisp/emacs-lisp/disass.el
@@ -96,7 +96,7 @@ redefine OBJECT if it is a symbol."
                                          (regexp-quote
                                           (concat "<"
                                                   (comp-c-func-name
-                                                   (subr-name obj) "F")
+                                                   (subr-name obj) "F" t)
                                                   ">:"))))
               (beginning-of-line)
               (delete-region (point-min) (point))



reply via email to

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