From: Richard Stallman <rms@gnu.org>
To: Glenn Morris <rgm@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: suppressing byte-compiler warnings about undefined functions
Date: Sun, 11 Nov 2007 14:33:51 -0500 [thread overview]
Message-ID: <E1IrIZ5-0002Bq-LB@fencepost.gnu.org> (raw)
In-Reply-To: <gid4uhlh75.fsf@fencepost.gnu.org> (message from Glenn Morris on Sat, 10 Nov 2007 20:11:10 -0500)
+ (defun declare-function (fn file &optional arglist)
Why not &rest?
+ Note that for the purposes of `check-declared-functions', this
+ statement must be the first non-whitespace on a line, and
+ everything up to the end of FILE must be all on the same line.
+ For example:
+
+ \(declare-function 'c-end-of-defun \"progmodes/cc-cmds.el\" '(&optional arg))"
Breaking the line after the file name
would make the example more helpful.
+ Note that for the purposes of `check-declared-functions', this
+ statement must be the first non-whitespace on a line, and
+ everything up to the end of FILE must be all on the same line.
+ For example:
+
+ \(declare-function 'c-end-of-defun \"progmodes/cc-cmds.el\" '(&optional arg))"
+ nil)
+
(defun make-obsolete (obsolete-name current-name &optional when)
"Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
The warning will say that CURRENT-NAME should be used instead.
*** bytecomp.el 10 Nov 2007 08:05:15 -0000 2.217
--- bytecomp.el 11 Nov 2007 00:35:23 -0000
***************
*** 1258,1264 ****
(byte-compile-fdefinition (car form) t)))
(sig (if (and def (not (eq def t)))
(byte-compile-arglist-signature
! (if (eq 'lambda (car-safe def))
(nth 1 def)
(if (byte-code-function-p def)
(aref def 0)
--- 1258,1264 ----
(byte-compile-fdefinition (car form) t)))
(sig (if (and def (not (eq def t)))
(byte-compile-arglist-signature
! (if (memq (car-safe def) '(declared lambda))
(nth 1 def)
(if (byte-code-function-p def)
(aref def 0)
***************
*** 2818,2823 ****
--- 2818,2831 ----
(body
(list body))))
+ (put 'declare-function 'byte-hunk-handler 'byte-compile-declare-function)
+ (defun byte-compile-declare-function (form)
+ (push (cons (eval (nth 1 form))
+ (list 'declared (eval (nth 3 form))))
+ byte-compile-function-environment)
+ nil)
+
+ \f
;; This is the recursive entry point for compiling each subform of an
;; expression.
;; If for-effect is non-nil, byte-compile-form will output a byte-discard
;; Adapted from authors.el.
(defmacro checkdec-visit (file &rest body)
"Execute the forms in BODY while visiting FILE.
Re-uses an existing buffer visiting FILE if there is one. The
value returned is the value of the last form in BODY."
(declare (indent 1))
`(let ((existing-buffer (find-buffer-visiting ,file))
(enable-local-variables :safe)
(enable-local-eval nil)
(buffer (find-file-noselect ,file)))
This would run a lot faster if it just reads the file
into a temporary buffer and avoids visiting.
checkdoc-scan could be far far more efficient. It should scan all
files for `declare-function' calls, sort them by the file that is
supposed to define them, then load each file just once to verify.
next prev parent reply other threads:[~2007-11-11 19:33 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-10 0:55 suppressing byte-compiler warnings about undefined functions Glenn Morris
2007-11-10 3:13 ` Stefan Monnier
2007-11-10 17:54 ` Richard Stallman
2007-11-11 1:11 ` Glenn Morris
2007-11-11 4:00 ` Glenn Morris
2007-11-11 19:33 ` Richard Stallman [this message]
2007-11-13 4:20 ` Glenn Morris
2007-11-13 9:31 ` martin rudalics
2007-11-14 5:32 ` Glenn Morris
2007-11-14 14:53 ` Stefan Monnier
2007-11-15 3:07 ` Richard Stallman
2007-11-17 3:58 ` Glenn Morris
2007-11-17 23:30 ` Richard Stallman
2007-11-13 20:02 ` Richard Stallman
2007-11-13 21:05 ` Stefan Monnier
2007-11-14 5:30 ` Glenn Morris
2007-11-15 3:06 ` Richard Stallman
[not found] ` <ur9oddrnmg0.fsf@mothra.ics.uci.edu>
2007-11-19 0:39 ` byte-compiler warnings about undefined functions can now be silenced Glenn Morris
2007-11-19 9:04 ` martin rudalics
2007-11-24 3:12 ` Glenn Morris
2007-11-19 19:02 ` Richard Stallman
2007-11-20 4:05 ` Glenn Morris
2007-11-19 19:33 ` Jay Belanger
2007-11-19 20:46 ` Glenn Morris
2007-11-20 12:12 ` Richard Stallman
2007-11-11 8:46 ` suppressing byte-compiler warnings about undefined functions Alan Mackenzie
2007-11-11 15:51 ` Dan Nicolaescu
2007-11-11 16:10 ` Alan Mackenzie
2007-11-11 16:18 ` Dan Nicolaescu
2007-11-11 18:32 ` Dan Nicolaescu
2007-11-11 23:54 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1IrIZ5-0002Bq-LB@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.