emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp/emacs-lisp bytecomp.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp/emacs-lisp bytecomp.el
Date: Thu, 10 Sep 2009 06:22:31 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/09/10 06:22:31

Modified files:
        lisp/emacs-lisp: bytecomp.el 

Log message:
        (byte-compile-function-environment): Doc fix.
        (byte-compile-file-form-autoload): Don't warn about unknown functions
        where the autoload statement comes after the use.
        (with-no-warnings): Give it a byte-hunk-handler like than of progn, so
        that any handlers inside the body (eg require) are in turn respected.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/emacs-lisp/bytecomp.el?cvsroot=emacs&r1=2.257&r2=2.258

Patches:
Index: bytecomp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/bytecomp.el,v
retrieving revision 2.257
retrieving revision 2.258
diff -u -b -r2.257 -r2.258
--- bytecomp.el 5 Sep 2009 19:10:40 -0000       2.257
+++ bytecomp.el 10 Sep 2009 06:22:30 -0000      2.258
@@ -532,7 +532,8 @@
 Each element looks like (FUNCTIONNAME . DEFINITION).  It is
 \(FUNCTIONNAME . nil) when a function is redefined as a macro.
 It is \(FUNCTIONNAME . t) when all we know is that it was defined,
-and we don't know the definition.")
+and we don't know the definition.  For an autoloaded function, DEFINITION
+has the form (autoload . FILENAME).")
 
 (defvar byte-compile-unresolved-functions nil
   "Alist of undefined functions to which calls have been compiled.
@@ -2301,13 +2302,25 @@
        (eval (nth 5 form))             ;Macro
        (eval form))                    ;Define the autoload.
   ;; Avoid undefined function warnings for the autoload.
-  (if (and (consp (nth 1 form))
+  (when (and (consp (nth 1 form))
           (eq (car (nth 1 form)) 'quote)
           (consp (cdr (nth 1 form)))
           (symbolp (nth 1 (nth 1 form))))
       (push (cons (nth 1 (nth 1 form))
                  (cons 'autoload (cdr (cdr form))))
-           byte-compile-function-environment))
+         byte-compile-function-environment)
+    ;; If an autoload occurs _before_ the first call to a function,
+    ;; byte-compile-callargs-warn does not add an entry to
+    ;; byte-compile-unresolved-functions.  Here we mimic the logic
+    ;; of byte-compile-callargs-warn so as not to warn if the
+    ;; autoload comes _after_ the function call.
+    ;; Alternatively, similar logic could go in
+    ;; byte-compile-warn-about-unresolved-functions.
+    (or (memq (nth 1 (nth 1 form)) byte-compile-noruntime-functions)
+       (setq byte-compile-unresolved-functions
+             (delq (assq (nth 1 (nth 1 form))
+                         byte-compile-unresolved-functions)
+                   byte-compile-unresolved-functions))))
   (if (stringp (nth 3 form))
       form
     ;; No doc string, so we can compile this as a normal form.
@@ -2387,6 +2400,14 @@
   ;; Return nil so the forms are not output twice.
   nil)
 
+(put 'with-no-warnings 'byte-hunk-handler
+     'byte-compile-file-form-with-no-warnings)
+(defun byte-compile-file-form-with-no-warnings (form)
+  ;; cf byte-compile-file-form-progn.
+  (let (byte-compile-warnings)
+    (mapc 'byte-compile-file-form (cdr form))
+    nil))
+
 ;; This handler is not necessary, but it makes the output from dont-compile
 ;; and similar macros cleaner.
 (put 'eval 'byte-hunk-handler 'byte-compile-file-form-eval)




reply via email to

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