[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f865e2f: Fix byte-compiler pacification for declare
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master f865e2f: Fix byte-compiler pacification for declare-function |
Date: |
Fri, 27 May 2016 02:10:50 +0000 (UTC) |
branch: master
commit f865e2f1e8878f7992d61a39bceb369c28a77706
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Fix byte-compiler pacification for declare-function
Problem reported by Michael Heerdegen in:
http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00590.html
* lisp/emacs-lisp/bytecomp.el:
(byte-compile-macroexpand-declare-function):
Revert signature to previous value.
* lisp/subr.el (declare-function): Change signature to
match the reverted signature used in the byte compiler.
---
lisp/emacs-lisp/bytecomp.el | 11 +++++------
lisp/subr.el | 8 +++++---
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index aa13210..11eb44c 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2958,24 +2958,23 @@ for symbols generated by the byte compiler itself."
(list body))))
;; Special macro-expander used during byte-compilation.
-(defun byte-compile-macroexpand-declare-function (fn file &optional arglist
- fileonly)
- (let ((gotargs (listp arglist))
+(defun byte-compile-macroexpand-declare-function (fn file &rest args)
+ (let ((gotargs (and (consp args) (listp (car args))))
(unresolved (assq fn byte-compile-unresolved-functions)))
(when unresolved ; function was called before declaration
(if (and gotargs (byte-compile-warning-enabled-p 'callargs))
- (byte-compile-arglist-warn fn arglist nil)
+ (byte-compile-arglist-warn fn (car args) nil)
(setq byte-compile-unresolved-functions
(delq unresolved byte-compile-unresolved-functions))))
(push (cons fn (if gotargs
- (list 'declared arglist)
+ (list 'declared (car args))
t)) ; Arglist not specified.
byte-compile-function-environment))
;; We are stating that it _will_ be defined at runtime.
(setq byte-compile-noruntime-functions
(delq fn byte-compile-noruntime-functions))
;; Delegate the rest to the normal macro definition.
- (macroexpand `(declare-function ,fn ,file ,arglist ,fileonly)))
+ (macroexpand `(declare-function ,fn ,file ,@args)))
;; This is the recursive entry point for compiling each subform of an
diff --git a/lisp/subr.el b/lisp/subr.el
index b5d6f6f..7cbf006 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -29,13 +29,13 @@
;; Beware: while this file has tag `utf-8', before it's compiled, it gets
;; loaded as "raw-text", so non-ASCII chars won't work right during bootstrap.
-(defmacro declare-function (_fn _file &optional _arglist _fileonly)
+(defmacro declare-function (_fn _file &rest _args)
"Tell the byte-compiler that function FN is defined, in FILE.
Optional ARGLIST is the argument list used by the function.
The FILE argument is not used by the byte-compiler, but by the
`check-declare' package, which checks that FILE contains a
-definition for FN. ARGLIST is used by both the byte-compiler
-and `check-declare' to check for consistency.
+definition for FN. Remaining ARGS are used by both the
+byte-compiler and `check-declare' to check for consistency.
FILE can be either a Lisp file (in which case the \".el\"
extension is optional), or a C file. C files are expanded
@@ -46,6 +46,8 @@ declaration. A FILE with an \"ext:\" prefix is an external
file.
`check-declare' will check such files if they are found, and skip
them without error if they are not.
+ARGS can contain one or two optional args. First optional arg
+ARGLIST specifies the function arguments. Second optional arg
FILEONLY non-nil means that `check-declare' will only check that
FILE exists, not that it defines FN. This is intended for
function-definitions that `check-declare' does not recognize, e.g.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f865e2f: Fix byte-compiler pacification for declare-function,
Paul Eggert <=