emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/bytecomp.el [emacs-unicod


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/bytecomp.el [emacs-unicode-2]
Date: Mon, 28 Jun 2004 04:57:33 -0400

Index: emacs/lisp/emacs-lisp/bytecomp.el
diff -c emacs/lisp/emacs-lisp/bytecomp.el:2.135.2.2 
emacs/lisp/emacs-lisp/bytecomp.el:2.135.2.3
*** emacs/lisp/emacs-lisp/bytecomp.el:2.135.2.2 Fri Apr 16 12:50:13 2004
--- emacs/lisp/emacs-lisp/bytecomp.el   Mon Jun 28 07:29:45 2004
***************
*** 832,855 ****
  
  ;; Log something that isn't a warning.
  (defmacro byte-compile-log (format-string &rest args)
!   (list 'and
!       'byte-optimize
!       '(memq byte-optimize-log '(t source))
!       (list 'let '((print-escape-newlines t)
!                    (print-level 4)
!                    (print-length 4))
!             (list 'byte-compile-log-1
!                   (cons 'format
!                     (cons format-string
!                       (mapcar
!                        (lambda (x)
!                          (if (symbolp x) (list 'prin1-to-string x) x))
!                        args)))))))
  
  ;; Log something that isn't a warning.
  (defun byte-compile-log-1 (string)
!   (save-excursion
!     (byte-goto-log-buffer)
      (goto-char (point-max))
      (byte-compile-warning-prefix nil nil)
      (cond (noninteractive
--- 832,853 ----
  
  ;; Log something that isn't a warning.
  (defmacro byte-compile-log (format-string &rest args)
!   `(and
!     byte-optimize
!     (memq byte-optimize-log '(t source))
!     (let ((print-escape-newlines t)
!         (print-level 4)
!         (print-length 4))
!       (byte-compile-log-1
!        (format
!       ,format-string
!       ,@(mapcar
!          (lambda (x) (if (symbolp x) (list 'prin1-to-string x) x))
!          args))))))
  
  ;; Log something that isn't a warning.
  (defun byte-compile-log-1 (string)
!   (with-current-buffer "*Compile-Log*"
      (goto-char (point-max))
      (byte-compile-warning-prefix nil nil)
      (cond (noninteractive
***************
*** 903,913 ****
  (defvar byte-compile-last-warned-form nil)
  (defvar byte-compile-last-logged-file nil)
  
- (defun byte-goto-log-buffer ()
-   (set-buffer (get-buffer-create "*Compile-Log*"))
-   (unless (eq major-mode 'compilation-mode)
-     (compilation-mode)))
- 
  ;; This is used as warning-prefix for the compiler.
  ;; It is always called with the warnings buffer current.
  (defun byte-compile-warning-prefix (level entry)
--- 901,906 ----
***************
*** 983,988 ****
--- 976,982 ----
           ;; Do this after setting default-directory.
           (unless (eq major-mode 'compilation-mode)
             (compilation-mode))
+          (compilation-forget-errors)
           pt))))
  
  ;; Log a message STRING in *Compile-Log*.
***************
*** 1014,1024 ****
         (when (nth 2 new)))
      (byte-compile-set-symbol-position (car form))
      (if (memq 'obsolete byte-compile-warnings)
!       (byte-compile-warn "%s is an obsolete function%s; %s" (car form)
                           (if when (concat " since " when) "")
                           (if (stringp (car new))
                               (car new)
!                            (format "use %s instead." (car new)))))
      (funcall (or handler 'byte-compile-normal-call) form)))
  
  ;; Compiler options
--- 1008,1018 ----
         (when (nth 2 new)))
      (byte-compile-set-symbol-position (car form))
      (if (memq 'obsolete byte-compile-warnings)
!       (byte-compile-warn "`%s' is an obsolete function%s; %s" (car form)
                           (if when (concat " since " when) "")
                           (if (stringp (car new))
                               (car new)
!                            (format "use `%s' instead." (car new)))))
      (funcall (or handler 'byte-compile-normal-call) form)))
  
  ;; Compiler options
***************
*** 2082,2088 ****
  (defun byte-compile-file-form-defsubst (form)
    (when (assq (nth 1 form) byte-compile-unresolved-functions)
      (setq byte-compile-current-form (nth 1 form))
!     (byte-compile-warn "defsubst %s was used before it was defined"
                       (nth 1 form)))
    (byte-compile-file-form
     (macroexpand form byte-compile-macro-environment))
--- 2076,2082 ----
  (defun byte-compile-file-form-defsubst (form)
    (when (assq (nth 1 form) byte-compile-unresolved-functions)
      (setq byte-compile-current-form (nth 1 form))
!     (byte-compile-warn "defsubst `%s' was used before it was defined"
                       (nth 1 form)))
    (byte-compile-file-form
     (macroexpand form byte-compile-macro-environment))
***************
*** 2212,2218 ****
                    (not (assq (nth 1 form)
                               byte-compile-initial-macro-environment)))
               (byte-compile-warn
!                "%s defined multiple times, as both function and macro"
                 (nth 1 form)))
           (setcdr that-one nil))
          (this-one
--- 2206,2212 ----
                    (not (assq (nth 1 form)
                               byte-compile-initial-macro-environment)))
               (byte-compile-warn
!                "`%s' defined multiple times, as both function and macro"
                 (nth 1 form)))
           (setcdr that-one nil))
          (this-one
***************
*** 2221,2234 ****
                    ;; byte-compiler macros in byte-run.el...
                    (not (assq (nth 1 form)
                               byte-compile-initial-macro-environment)))
!            (byte-compile-warn "%s %s defined multiple times in this file"
                                (if macrop "macro" "function")
                                (nth 1 form))))
          ((and (fboundp name)
                (eq (car-safe (symbol-function name))
                    (if macrop 'lambda 'macro)))
           (when (memq 'redefine byte-compile-warnings)
!            (byte-compile-warn "%s %s being redefined as a %s"
                                (if macrop "function" "macro")
                                (nth 1 form)
                                (if macrop "macro" "function")))
--- 2215,2228 ----
                    ;; byte-compiler macros in byte-run.el...
                    (not (assq (nth 1 form)
                               byte-compile-initial-macro-environment)))
!            (byte-compile-warn "%s `%s' defined multiple times in this file"
                                (if macrop "macro" "function")
                                (nth 1 form))))
          ((and (fboundp name)
                (eq (car-safe (symbol-function name))
                    (if macrop 'lambda 'macro)))
           (when (memq 'redefine byte-compile-warnings)
!            (byte-compile-warn "%s `%s' being redefined as a %s"
                                (if macrop "function" "macro")
                                (nth 1 form)
                                (if macrop "macro" "function")))
***************
*** 2701,2707 ****
                (handler (get fn 'byte-compile)))
           (byte-compile-set-symbol-position fn)
           (when (byte-compile-const-symbol-p fn)
!            (byte-compile-warn "%s called as a function" fn))
           (if (and handler
                    (or (not (byte-compile-version-cond
                              byte-compile-compatibility))
--- 2695,2701 ----
                (handler (get fn 'byte-compile)))
           (byte-compile-set-symbol-position fn)
           (when (byte-compile-const-symbol-p fn)
!            (byte-compile-warn "`%s' called as a function" fn))
           (if (and handler
                    (or (not (byte-compile-version-cond
                              byte-compile-compatibility))
***************
*** 2736,2744 ****
    (if (or (not (symbolp var))
          (byte-compile-const-symbol-p var (not (eq base-op 'byte-varref))))
        (byte-compile-warn
!        (cond ((eq base-op 'byte-varbind) "attempt to let-bind %s %s")
!            ((eq base-op 'byte-varset) "variable assignment to %s %s")
!            (t "variable reference to %s %s"))
         (if (symbolp var) "constant" "nonvariable")
         (prin1-to-string var))
      (if (and (get var 'byte-obsolete-variable)
--- 2730,2738 ----
    (if (or (not (symbolp var))
          (byte-compile-const-symbol-p var (not (eq base-op 'byte-varref))))
        (byte-compile-warn
!        (cond ((eq base-op 'byte-varbind) "attempt to let-bind %s `%s'")
!            ((eq base-op 'byte-varset) "variable assignment to %s `%s'")
!            (t "variable reference to %s `%s'"))
         (if (symbolp var) "constant" "nonvariable")
         (prin1-to-string var))
      (if (and (get var 'byte-obsolete-variable)
***************
*** 2746,2756 ****
             (not (eq var byte-compile-not-obsolete-var)))
        (let* ((ob (get var 'byte-obsolete-variable))
               (when (cdr ob)))
!         (byte-compile-warn "%s is an obsolete variable%s; %s" var
                             (if when (concat " since " when) "")
                             (if (stringp (car ob))
                                 (car ob)
!                              (format "use %s instead." (car ob))))))
      (if (memq 'free-vars byte-compile-warnings)
        (if (eq base-op 'byte-varbind)
            (push var byte-compile-bound-variables)
--- 2740,2750 ----
             (not (eq var byte-compile-not-obsolete-var)))
        (let* ((ob (get var 'byte-obsolete-variable))
               (when (cdr ob)))
!         (byte-compile-warn "`%s' is an obsolete variable%s; %s" var
                             (if when (concat " since " when) "")
                             (if (stringp (car ob))
                                 (car ob)
!                              (format "use `%s' instead." (car ob))))))
      (if (memq 'free-vars byte-compile-warnings)
        (if (eq base-op 'byte-varbind)
            (push var byte-compile-bound-variables)
***************
*** 2759,2769 ****
              (if (eq base-op 'byte-varset)
                  (or (memq var byte-compile-free-assignments)
                      (progn
!                       (byte-compile-warn "assignment to free variable %s" var)
                        (push var byte-compile-free-assignments)))
                (or (memq var byte-compile-free-references)
                    (progn
!                     (byte-compile-warn "reference to free variable %s" var)
                      (push var byte-compile-free-references))))))))
    (let ((tmp (assq var byte-compile-variables)))
      (unless tmp
--- 2753,2763 ----
              (if (eq base-op 'byte-varset)
                  (or (memq var byte-compile-free-assignments)
                      (progn
!                       (byte-compile-warn "assignment to free variable `%s'" 
var)
                        (push var byte-compile-free-assignments)))
                (or (memq var byte-compile-free-references)
                    (progn
!                     (byte-compile-warn "reference to free variable `%s'" var)
                      (push var byte-compile-free-references))))))))
    (let ((tmp (assq var byte-compile-variables)))
      (unless tmp
***************
*** 2964,2970 ****
  
  (defun byte-compile-subr-wrong-args (form n)
    (byte-compile-set-symbol-position (car form))
!   (byte-compile-warn "%s called with %d arg%s, but requires %s"
                     (car form) (length (cdr form))
                     (if (= 1 (length (cdr form))) "" "s") n)
    ;; get run-time wrong-number-of-args error.
--- 2958,2964 ----
  
  (defun byte-compile-subr-wrong-args (form n)
    (byte-compile-set-symbol-position (car form))
!   (byte-compile-warn "`%s' called with %d arg%s, but requires %s"
                     (car form) (length (cdr form))
                     (if (= 1 (length (cdr form))) "" "s") n)
    ;; get run-time wrong-number-of-args error.
***************
*** 3130,3136 ****
          (if (and (consp (car body))
                   (not (eq 'byte-code (car (car body)))))
              (byte-compile-warn
!       "A quoted lambda form is the second argument of fset.  This is probably
       not what you want, as that lambda cannot be compiled.  Consider using
       the syntax (function (lambda (...) ...)) instead.")))))
    (byte-compile-two-args form))
--- 3124,3130 ----
          (if (and (consp (car body))
                   (not (eq 'byte-code (car (car body)))))
              (byte-compile-warn
!       "A quoted lambda form is the second argument of `fset'.  This is 
probably
       not what you want, as that lambda cannot be compiled.  Consider using
       the syntax (function (lambda (...) ...)) instead.")))))
    (byte-compile-two-args form))
***************
*** 3515,3521 ****
      (byte-compile-set-symbol-position 'condition-case)
      (unless (symbolp var)
        (byte-compile-warn
!        "%s is not a variable-name or nil (in condition-case)" var))
      (byte-compile-push-constant var)
      (byte-compile-push-constant (byte-compile-top-level
                                 (nth 2 form) for-effect))
--- 3509,3515 ----
      (byte-compile-set-symbol-position 'condition-case)
      (unless (symbolp var)
        (byte-compile-warn
!        "`%s' is not a variable-name or nil (in condition-case)" var))
      (byte-compile-push-constant var)
      (byte-compile-push-constant (byte-compile-top-level
                                 (nth 2 form) for-effect))
***************
*** 3533,3545 ****
                                   (setq syms (cdr syms)))
                                 ok))))
                   (byte-compile-warn
!                    "%s is not a condition name or list of such (in 
condition-case)"
                     (prin1-to-string condition)))
  ;;                ((not (or (eq condition 't)
  ;;                      (and (stringp (get condition 'error-message))
  ;;                           (consp (get condition 'error-conditions)))))
  ;;                 (byte-compile-warn
! ;;                   "%s is not a known condition name (in condition-case)"
  ;;                   condition))
                )
          (setq compiled-clauses
--- 3527,3539 ----
                                   (setq syms (cdr syms)))
                                 ok))))
                   (byte-compile-warn
!                    "`%s' is not a condition name or list of such (in 
condition-case)"
                     (prin1-to-string condition)))
  ;;                ((not (or (eq condition 't)
  ;;                      (and (stringp (get condition 'error-message))
  ;;                           (consp (get condition 'error-conditions)))))
  ;;                 (byte-compile-warn
! ;;                   "`%s' is not a known condition name (in condition-case)"
  ;;                   condition))
                )
          (setq compiled-clauses
***************
*** 3635,3641 ****
              (and (eq fun 'defconst) (null (cddr form))))
        (let ((ncall (length (cdr form))))
        (byte-compile-warn
!        "%s called with %d argument%s, but %s %s"
         fun ncall
         (if (= 1 ncall) "" "s")
         (if (< ncall 2) "requires" "accepts only")
--- 3629,3635 ----
              (and (eq fun 'defconst) (null (cddr form))))
        (let ((ncall (length (cdr form))))
        (byte-compile-warn
!        "`%s' called with %d argument%s, but %s %s"
         fun ncall
         (if (= 1 ncall) "" "s")
         (if (< ncall 2) "requires" "accepts only")
***************
*** 3652,3658 ****
        `(push ',var current-load-list))
        (when (> (length form) 3)
        (when (and string (not (stringp string)))
!         (byte-compile-warn "third arg to %s %s is not a string: %s"
                             fun var string))
        `(put ',var 'variable-documentation ,string))
        (if (cddr form)         ; `value' provided
--- 3646,3652 ----
        `(push ',var current-load-list))
        (when (> (length form) 3)
        (when (and string (not (stringp string)))
!         (byte-compile-warn "third arg to `%s %s' is not a string: %s"
                             fun var string))
        `(put ',var 'variable-documentation ,string))
        (if (cddr form)         ; `value' provided
***************
*** 3718,3724 ****
  (byte-defop-compiler-1 with-no-warnings byte-compile-no-warnings)
  (defun byte-compile-no-warnings (form)
    (let (byte-compile-warnings)
!     (byte-compile-form (cadr form))))
  
  ;;; tags
  
--- 3712,3718 ----
  (byte-defop-compiler-1 with-no-warnings byte-compile-no-warnings)
  (defun byte-compile-no-warnings (form)
    (let (byte-compile-warnings)
!     (byte-compile-form (cons 'progn (cdr form)))))
  
  ;;; tags
  
***************
*** 3993,3999 ****
         nil))))
  
  ;;;###autoload
! (defun batch-byte-recompile-directory ()
    "Run `byte-recompile-directory' on the dirs remaining on the command line.
  Must be used only with `-batch', and kills Emacs on completion.
  For example, invoke `emacs -batch -f batch-byte-recompile-directory .'."
--- 3987,3993 ----
         nil))))
  
  ;;;###autoload
! (defun batch-byte-recompile-directory (&optional arg)
    "Run `byte-recompile-directory' on the dirs remaining on the command line.
  Must be used only with `-batch', and kills Emacs on completion.
  For example, invoke `emacs -batch -f batch-byte-recompile-directory .'."
***************
*** 4004,4010 ****
    (or command-line-args-left
        (setq command-line-args-left '(".")))
    (while command-line-args-left
!     (byte-recompile-directory (car command-line-args-left))
      (setq command-line-args-left (cdr command-line-args-left)))
    (kill-emacs 0))
  
--- 3998,4004 ----
    (or command-line-args-left
        (setq command-line-args-left '(".")))
    (while command-line-args-left
!     (byte-recompile-directory (car command-line-args-left) arg)
      (setq command-line-args-left (cdr command-line-args-left)))
    (kill-emacs 0))
  




reply via email to

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