aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-11-22 06:53:24 +0000
committerGlenn Morris2007-11-22 06:53:24 +0000
commit64cea5550d3c36c42da295585b8591e7fc58e6a6 (patch)
tree248e81859c528ff28fe1567963631bb3eaad97e8
parentd5cf82def8b4b45a7a1295d38c1eddacecac5898 (diff)
downloademacs-64cea5550d3c36c42da295585b8591e7fc58e6a6.tar.gz
emacs-64cea5550d3c36c42da295585b8591e7fc58e6a6.zip
(check-declare-verify): Fix previous change. Warn if could not find
an arglist to check.
-rw-r--r--lisp/emacs-lisp/check-declare.el48
1 files changed, 29 insertions, 19 deletions
diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el
index c1cdb3a2e80..a4767794132 100644
--- a/lisp/emacs-lisp/check-declare.el
+++ b/lisp/emacs-lisp/check-declare.el
@@ -108,17 +108,22 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\
108 ;; (min . max) for a fixed number of arguments, or 108 ;; (min . max) for a fixed number of arguments, or
109 ;; arglists with optional elements. 109 ;; arglists with optional elements.
110 ;; (min) for arglists with &rest. 110 ;; (min) for arglists with &rest.
111 ;; sig = 'err means we could not find an arglist.
111 sig (cond (cflag 112 sig (cond (cflag
112 (re-search-forward "," nil t 3) 113 (or
113 (skip-chars-forward " \t\n") 114 (when (re-search-forward "," nil t 3)
114 ;; Assuming minargs and maxargs on same line. 115 (skip-chars-forward " \t\n")
115 (when (looking-at "\\([0-9]+\\)[ \t]*,[ \t]*\ 116 ;; Assuming minargs and maxargs on same line.
117 (when (looking-at "\\([0-9]+\\)[ \t]*,[ \t]*\
116\\([0-9]+\\|MANY\\|UNEVALLED\\)") 118\\([0-9]+\\|MANY\\|UNEVALLED\\)")
117 (setq minargs (string-to-number (match-string 1)) 119 (setq minargs (string-to-number
118 maxargs (match-string 2)) 120 (match-string 1))
119 (cons minargs (unless (string-match "[^0-9]" 121 maxargs (match-string 2))
120 maxargs) 122 (cons minargs (unless (string-match "[^0-9]"
121 (string-to-number maxargs))))) 123 maxargs)
124 (string-to-number
125 maxargs)))))
126 'err))
122 ((string-equal (match-string 1) 127 ((string-equal (match-string 1)
123 "define-derived-mode") 128 "define-derived-mode")
124 '(0 . 0)) 129 '(0 . 0))
@@ -129,24 +134,29 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\
129 ((string-equal (match-string 1) 134 ((string-equal (match-string 1)
130 "defalias") 135 "defalias")
131 t) 136 t)
137 ((looking-at "\\((\\|nil\\)")
138 (byte-compile-arglist-signature
139 (read (current-buffer))))
132 (t 140 (t
133 (if (looking-at "\\((\\|nil\\)") 141 'err))
134 (byte-compile-arglist-signature
135 (read (current-buffer))))))
136 ;; alist of functions and arglist signatures. 142 ;; alist of functions and arglist signatures.
137 siglist (cons (cons fn sig) siglist))))) 143 siglist (cons (cons fn sig) siglist)))))
138 (dolist (e fnlist) 144 (dolist (e fnlist)
139 (setq arglist (nth 2 e) 145 (setq arglist (nth 2 e)
140 type 146 type
141 (if re ; re non-nil means found a file 147 (if re ; re non-nil means found a file
142 (if (setq sig (assoc (cadr e) siglist)) 148 (if (setq sig (assoc (cadr e) siglist)) ; found function
143 ;; Recall we use t to mean no arglist specified, 149 ;; Recall we use t to mean no arglist specified,
144 ;; to distinguish from an empty arglist. 150 ;; to distinguish from an empty arglist.
145 (unless (or (eq arglist t) 151 (unless (eq arglist t)
146 (eq sig t)) 152 (setq sig (cdr-safe sig))
147 (unless (equal (byte-compile-arglist-signature arglist) 153 (cond ((eq sig t)) ; defalias, can't check
148 (cdr sig)) 154 ((eq sig 'err)
149 "arglist mismatch")) 155 "arglist not found") ; internal error
156 ((not (equal (byte-compile-arglist-signature
157 arglist)
158 sig))
159 "arglist mismatch")))
150 "function not found") 160 "function not found")
151 "file not found")) 161 "file not found"))
152 (when type 162 (when type