1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

Change 'type' declaration to 'ftype'

* lisp/window.el (get-lru-window, get-largest-window)
(one-window-p): Update function type declaration.
* lisp/subr.el (ignore, error, zerop, fixnump, bignump, lsh)
(last, eventp, mouse-movement-p, log10, memory-limit)
(internal-pop-keymap): Likewise.
* lisp/simple.el (count-lines, mark, string-empty-p): Likewise.
* lisp/files.el (parse-colon-path): Likewise.
* lisp/env.el (getenv): Likewise.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt): Likewise.
* lisp/emacs-lisp/lisp.el (buffer-end): Likewise.
* lisp/emacs-lisp/comp.el (comp--final): Likewise.
* lisp/custom.el (custom-variable-p): Likewise.
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Rename 'type'
-> 'ftype'.
This commit is contained in:
Andrea Corallo 2024-05-14 09:24:05 +02:00
parent 041aa3ffc6
commit 6e1bb713f6
10 changed files with 26 additions and 26 deletions

View File

@ -667,7 +667,7 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable."
A customizable variable is either (i) a variable whose property
list contains a non-nil `standard-value' or `custom-autoload'
property, or (ii) an alias for another customizable variable."
(declare (type (function (symbol) t))
(declare (ftype (function (symbol) t))
(side-effect-free t))
(when (symbolp variable)
(setq variable (indirect-variable variable))

View File

@ -251,7 +251,7 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
(list 'completion #'byte-run--set-completion)
(list 'modes #'byte-run--set-modes)
(list 'interactive-args #'byte-run--set-interactive-args)
(list 'type #'byte-run--set-function-type))
(list 'ftype #'byte-run--set-function-type))
"List associating function properties to their macro expansion.
Each element of the list takes the form (PROP FUN) where FUN is
a function. For each (PROP . VALUES) in a function's declaration,

View File

@ -3325,12 +3325,12 @@ Prepare every function for final compilation and drive the C back-end."
;; are assumed just to be true. Use with extreme caution...
(defun comp-hint-fixnum (x)
(declare (type (function (t) fixnum))
(declare (ftype (function (t) fixnum))
(gv-setter (lambda (val) `(setf ,x ,val))))
x)
(defun comp-hint-cons (x)
(declare (type (function (t) cons))
(declare (ftype (function (t) cons))
(gv-setter (lambda (val) `(setf ,x ,val))))
x)

View File

@ -534,7 +534,7 @@ major mode's decisions about context.")
"Return the \"far end\" position of the buffer, in direction ARG.
If ARG is positive, that's the end of the buffer.
Otherwise, that's the beginning of the buffer."
(declare (type (function ((or number marker)) integer))
(declare (ftype (function ((or number marker)) integer))
(side-effect-free error-free))
(if (> arg 0) (point-max) (point-min)))

View File

@ -130,7 +130,7 @@ usually more efficient than that of a simplified version:
(concat (car parens)
(mapconcat \\='regexp-quote strings \"\\\\|\")
(cdr parens))))"
(declare (type (function (list &optional t) string))
(declare (ftype (function (list &optional t) string))
(pure t) (side-effect-free t))
(save-match-data
;; Recurse on the sorted list.

View File

@ -207,7 +207,7 @@ parameter.
Otherwise, this function searches `process-environment' for
VARIABLE. If it is not found there, then it continues the search
in the environment list of the selected frame."
(declare (type (function (string &optional frame) (or null string)))
(declare (ftype (function (string &optional frame) (or null string)))
(side-effect-free t))
(interactive (list (read-envvar-name "Get environment variable: " t)))
(let ((value (getenv-internal (if (multibyte-string-p variable)

View File

@ -862,7 +862,7 @@ GNU and Unix systems). Substitute environment variables into the
resulting list of directory names. For an empty path element (i.e.,
a leading or trailing separator, or two adjacent separators), return
nil (meaning `default-directory') as the associated list element."
(declare (type (function (string) list)))
(declare (ftype (function (string) list)))
(when (stringp search-path)
(let ((spath (substitute-env-vars search-path))
(double-slash-special-p

View File

@ -1762,7 +1762,7 @@ not at the start of a line.
When IGNORE-INVISIBLE-LINES is non-nil, invisible lines are not
included in the count."
(declare (type (function ((or integer marker) (or integer marker) &optional t)
(declare (ftype (function ((or integer marker) (or integer marker) &optional t)
integer))
(side-effect-free t))
(save-excursion
@ -6884,7 +6884,7 @@ is active, and returns an integer or nil in the usual way.
If you are using this in an editing command, you are most likely making
a mistake; see the documentation of `set-mark'."
(declare (type (function (&optional t) (or integer null)))
(declare (ftype (function (&optional t) (or integer null)))
(side-effect-free t))
(if (or force (not transient-mark-mode) mark-active mark-even-if-inactive)
(marker-position (mark-marker))
@ -11147,7 +11147,7 @@ killed."
(defun lax-plist-get (plist prop)
"Extract a value from a property list, comparing with `equal'."
(declare (type (function (list t) t))
(declare (ftype (function (list t) t))
(pure t) (side-effect-free t) (obsolete plist-get "29.1"))
(plist-get plist prop #'equal))

View File

@ -451,7 +451,7 @@ This function accepts any number of arguments in ARGUMENTS.
Also see `always'."
;; Not declared `side-effect-free' because we don't want calls to it
;; elided; see `byte-compile-ignore'.
(declare (type (function (&rest t) null))
(declare (ftype (function (&rest t) null))
(pure t) (completion ignore))
(interactive)
nil)
@ -481,7 +481,7 @@ for the sake of consistency.
To alter the look of the displayed error messages, you can use
the `command-error-function' variable."
(declare (type (function (string &rest t) nil))
(declare (ftype (function (string &rest t) nil))
(advertised-calling-convention (string &rest args) "23.1"))
(signal 'error (list (apply #'format-message args))))
@ -547,21 +547,21 @@ was called."
"Return t if NUMBER is zero."
;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
;; = has a byte-code.
(declare (type (function (number) boolean))
(declare (ftype (function (number) boolean))
(pure t) (side-effect-free t)
(compiler-macro (lambda (_) `(= 0 ,number))))
(= 0 number))
(defun fixnump (object)
"Return t if OBJECT is a fixnum."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(side-effect-free error-free))
(and (integerp object)
(<= most-negative-fixnum object most-positive-fixnum)))
(defun bignump (object)
"Return t if OBJECT is a bignum."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(side-effect-free error-free))
(and (integerp object) (not (fixnump object))))
@ -575,7 +575,7 @@ Most uses of this function turn out to be mistakes. We recommend
to use `ash' instead, unless COUNT could ever be negative, and
if, when COUNT is negative, your program really needs the special
treatment of negative COUNT provided by this function."
(declare (type (function (integer integer) integer))
(declare (ftype (function (integer integer) integer))
(compiler-macro
(lambda (form)
(macroexp-warn-and-return
@ -754,7 +754,7 @@ treatment of negative COUNT provided by this function."
If LIST is nil, return nil.
If N is non-nil, return the Nth-to-last link of LIST.
If N is bigger than the length of LIST, return LIST."
(declare (type (function (list &optional integer) list))
(declare (ftype (function (list &optional integer) list))
(pure t) (side-effect-free t)) ; pure up to mutation
(if n
(and (>= n 0)
@ -1592,7 +1592,7 @@ See also `current-global-map'.")
(defun eventp (object)
"Return non-nil if OBJECT is an input event or event object."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(pure t) (side-effect-free error-free))
(or (integerp object)
(and (if (consp object)
@ -1660,7 +1660,7 @@ in the current Emacs session, then this function may return nil."
(defsubst mouse-movement-p (object)
"Return non-nil if OBJECT is a mouse movement event."
(declare (type (function (t) boolean))
(declare (ftype (function (t) boolean))
(side-effect-free error-free))
(eq (car-safe object) 'mouse-movement))
@ -1970,7 +1970,7 @@ be a list of the form returned by `event-start' and `event-end'."
(defun log10 (x)
"Return (log X 10), the log base 10 of X."
(declare (type (function (number) float))
(declare (ftype (function (number) float))
(side-effect-free t) (obsolete log "24.4"))
(log x 10))
@ -3257,7 +3257,7 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'."
(defun memory-limit ()
"Return an estimate of Emacs virtual memory usage, divided by 1024."
(declare (type (function () integer))
(declare (ftype (function () integer))
(side-effect-free error-free))
(let ((default-directory temporary-file-directory))
(or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0)))
@ -6492,7 +6492,7 @@ To test whether a function can be called interactively, use
`commandp'."
;; Kept around for now. See discussion at:
;; https://lists.gnu.org/r/emacs-devel/2020-08/msg00564.html
(declare (type (function () boolean))
(declare (ftype (function () boolean))
(obsolete called-interactively-p "23.2")
(side-effect-free error-free))
(called-interactively-p 'interactive))

View File

@ -2515,7 +2515,7 @@ have special meanings:
Any other value of ALL-FRAMES means consider all windows on the
selected frame and no others."
(declare (type (function (&optional t t t) (or window null)))
(declare (ftype (function (&optional t t t) (or window null)))
(side-effect-free error-free))
(let ((windows (window-list-1 nil 'nomini all-frames))
best-window best-time second-best-window second-best-time time)
@ -2595,7 +2595,7 @@ have special meanings:
Any other value of ALL-FRAMES means consider all windows on the
selected frame and no others."
(declare (type (function (&optional t t t) (or window null)))
(declare (ftype (function (&optional t t t) (or window null)))
(side-effect-free error-free))
(let ((best-size 0)
best-window size)
@ -4091,7 +4091,7 @@ with a special meaning are:
Anything else means consider all windows on the selected frame
and no others."
(declare (type (function (&optional t t) boolean))
(declare (ftype (function (&optional t t) boolean))
(side-effect-free error-free))
(let ((base-window (selected-window)))
(if (and nomini (eq base-window (minibuffer-window)))