diff options
| author | Paul Eggert | 2016-05-26 19:10:26 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-05-26 19:10:47 -0700 |
| commit | f865e2f1e8878f7992d61a39bceb369c28a77706 (patch) | |
| tree | e289a0ecdc822544877a6fe7839bd2b7803352ef | |
| parent | 2f58c503dd8acd3429469d76d04976a9017b87e3 (diff) | |
| download | emacs-f865e2f1e8878f7992d61a39bceb369c28a77706.tar.gz emacs-f865e2f1e8878f7992d61a39bceb369c28a77706.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 11 | ||||
| -rw-r--r-- | 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 aa13210b633..11eb44cea31 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." | |||
| 2958 | (list body)))) | 2958 | (list body)))) |
| 2959 | 2959 | ||
| 2960 | ;; Special macro-expander used during byte-compilation. | 2960 | ;; Special macro-expander used during byte-compilation. |
| 2961 | (defun byte-compile-macroexpand-declare-function (fn file &optional arglist | 2961 | (defun byte-compile-macroexpand-declare-function (fn file &rest args) |
| 2962 | fileonly) | 2962 | (let ((gotargs (and (consp args) (listp (car args)))) |
| 2963 | (let ((gotargs (listp arglist)) | ||
| 2964 | (unresolved (assq fn byte-compile-unresolved-functions))) | 2963 | (unresolved (assq fn byte-compile-unresolved-functions))) |
| 2965 | (when unresolved ; function was called before declaration | 2964 | (when unresolved ; function was called before declaration |
| 2966 | (if (and gotargs (byte-compile-warning-enabled-p 'callargs)) | 2965 | (if (and gotargs (byte-compile-warning-enabled-p 'callargs)) |
| 2967 | (byte-compile-arglist-warn fn arglist nil) | 2966 | (byte-compile-arglist-warn fn (car args) nil) |
| 2968 | (setq byte-compile-unresolved-functions | 2967 | (setq byte-compile-unresolved-functions |
| 2969 | (delq unresolved byte-compile-unresolved-functions)))) | 2968 | (delq unresolved byte-compile-unresolved-functions)))) |
| 2970 | (push (cons fn (if gotargs | 2969 | (push (cons fn (if gotargs |
| 2971 | (list 'declared arglist) | 2970 | (list 'declared (car args)) |
| 2972 | t)) ; Arglist not specified. | 2971 | t)) ; Arglist not specified. |
| 2973 | byte-compile-function-environment)) | 2972 | byte-compile-function-environment)) |
| 2974 | ;; We are stating that it _will_ be defined at runtime. | 2973 | ;; We are stating that it _will_ be defined at runtime. |
| 2975 | (setq byte-compile-noruntime-functions | 2974 | (setq byte-compile-noruntime-functions |
| 2976 | (delq fn byte-compile-noruntime-functions)) | 2975 | (delq fn byte-compile-noruntime-functions)) |
| 2977 | ;; Delegate the rest to the normal macro definition. | 2976 | ;; Delegate the rest to the normal macro definition. |
| 2978 | (macroexpand `(declare-function ,fn ,file ,arglist ,fileonly))) | 2977 | (macroexpand `(declare-function ,fn ,file ,@args))) |
| 2979 | 2978 | ||
| 2980 | 2979 | ||
| 2981 | ;; This is the recursive entry point for compiling each subform of an | 2980 | ;; This is the recursive entry point for compiling each subform of an |
diff --git a/lisp/subr.el b/lisp/subr.el index b5d6f6fa01b..7cbf0063ac1 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -29,13 +29,13 @@ | |||
| 29 | ;; Beware: while this file has tag `utf-8', before it's compiled, it gets | 29 | ;; Beware: while this file has tag `utf-8', before it's compiled, it gets |
| 30 | ;; loaded as "raw-text", so non-ASCII chars won't work right during bootstrap. | 30 | ;; loaded as "raw-text", so non-ASCII chars won't work right during bootstrap. |
| 31 | 31 | ||
| 32 | (defmacro declare-function (_fn _file &optional _arglist _fileonly) | 32 | (defmacro declare-function (_fn _file &rest _args) |
| 33 | "Tell the byte-compiler that function FN is defined, in FILE. | 33 | "Tell the byte-compiler that function FN is defined, in FILE. |
| 34 | Optional ARGLIST is the argument list used by the function. | 34 | Optional ARGLIST is the argument list used by the function. |
| 35 | The FILE argument is not used by the byte-compiler, but by the | 35 | The FILE argument is not used by the byte-compiler, but by the |
| 36 | `check-declare' package, which checks that FILE contains a | 36 | `check-declare' package, which checks that FILE contains a |
| 37 | definition for FN. ARGLIST is used by both the byte-compiler | 37 | definition for FN. Remaining ARGS are used by both the |
| 38 | and `check-declare' to check for consistency. | 38 | byte-compiler and `check-declare' to check for consistency. |
| 39 | 39 | ||
| 40 | FILE can be either a Lisp file (in which case the \".el\" | 40 | FILE can be either a Lisp file (in which case the \".el\" |
| 41 | extension is optional), or a C file. C files are expanded | 41 | 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. | |||
| 46 | `check-declare' will check such files if they are found, and skip | 46 | `check-declare' will check such files if they are found, and skip |
| 47 | them without error if they are not. | 47 | them without error if they are not. |
| 48 | 48 | ||
| 49 | ARGS can contain one or two optional args. First optional arg | ||
| 50 | ARGLIST specifies the function arguments. Second optional arg | ||
| 49 | FILEONLY non-nil means that `check-declare' will only check that | 51 | FILEONLY non-nil means that `check-declare' will only check that |
| 50 | FILE exists, not that it defines FN. This is intended for | 52 | FILE exists, not that it defines FN. This is intended for |
| 51 | function-definitions that `check-declare' does not recognize, e.g. | 53 | function-definitions that `check-declare' does not recognize, e.g. |