comparison lisp/emacs-lisp/check-declare.el @ 86528:db04d9e790f1

(check-declare-locate): Reflow doc. (check-declare-verify): Handle fset.
author Glenn Morris <rgm@gnu.org>
date Wed, 28 Nov 2007 03:53:44 +0000
parents 47fc5bc30170
children bf4a9f989c37
comparison
equal deleted inserted replaced
86527:682e5662f715 86528:db04d9e790f1
44 "Name of buffer used to display any `check-declare' warnings.") 44 "Name of buffer used to display any `check-declare' warnings.")
45 45
46 (defun check-declare-locate (file basefile) 46 (defun check-declare-locate (file basefile)
47 "Return the full path of FILE. 47 "Return the full path of FILE.
48 Expands files with a \".c\" extension relative to the Emacs 48 Expands files with a \".c\" extension relative to the Emacs
49 \"src/\" directory. Otherwise, `locate-library' searches for 49 \"src/\" directory. Otherwise, `locate-library' searches for FILE.
50 FILE. If that fails, expands FILE relative to BASEFILE's 50 If that fails, expands FILE relative to BASEFILE's directory part.
51 directory part. The returned file might not exist." 51 The returned file might not exist."
52 (if (string-equal "c" (file-name-extension file)) 52 (if (string-equal "c" (file-name-extension file))
53 (expand-file-name file (expand-file-name "src" source-directory)) 53 (expand-file-name file (expand-file-name "src" source-directory))
54 (let ((tfile (locate-library (file-name-nondirectory file)))) 54 (let ((tfile (locate-library (file-name-nondirectory file))))
55 (if tfile 55 (if tfile
56 (progn 56 (progn
110 (with-temp-buffer 110 (with-temp-buffer
111 (insert-file-contents fnfile) 111 (insert-file-contents fnfile)
112 ;; defsubst's don't _have_ to be known at compile time. 112 ;; defsubst's don't _have_ to be known at compile time.
113 (setq re (format (if cflag 113 (setq re (format (if cflag
114 "^[ \t]*\\(DEFUN\\)[ \t]*([ \t]*\"%s\"" 114 "^[ \t]*\\(DEFUN\\)[ \t]*([ \t]*\"%s\""
115 "^[ \t]*(\\(def\\(?:un\\|subst\\|\ 115 "^[ \t]*(\\(fset[ \t]+'\\|def\\(?:un\\|subst\\|\
116 ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ 116 ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\
117 \\|\\(?:ine-obsolete-function-\\)?alias[ \t]+'\\)\\)\ 117 \\|\\(?:ine-obsolete-function-\\)?alias[ \t]+'\\)\\)\
118 \[ \t]*%s\\([ \t;]+\\|$\\)") 118 \[ \t]*%s\\([ \t;]+\\|$\\)")
119 (regexp-opt (mapcar 'cadr fnlist) t))) 119 (regexp-opt (mapcar 'cadr fnlist) t)))
120 (while (re-search-forward re nil t) 120 (while (re-search-forward re nil t)
151 ;; Prompt to update. 151 ;; Prompt to update.
152 ((string-match 152 ((string-match
153 "\\`define-obsolete-function-alias\\>" 153 "\\`define-obsolete-function-alias\\>"
154 type) 154 type)
155 'obsolete) 155 'obsolete)
156 ;; Can't easily check alias arguments. 156 ;; Can't easily check arguments in these cases.
157 ((string-match "\\`defalias\\>" type) 157 ((string-match "\\`\\(defalias\\|fset\\)\\>" type)
158 t) 158 t)
159 ((looking-at "\\((\\|nil\\)") 159 ((looking-at "\\((\\|nil\\)")
160 (byte-compile-arglist-signature 160 (byte-compile-arglist-signature
161 (read (current-buffer)))) 161 (read (current-buffer))))
162 (t 162 (t
174 (cond ((eq sig 'obsolete) ; check even when no arglist specified 174 (cond ((eq sig 'obsolete) ; check even when no arglist specified
175 "obsolete alias") 175 "obsolete alias")
176 ;; arglist t means no arglist specified, as 176 ;; arglist t means no arglist specified, as
177 ;; opposed to an empty arglist. 177 ;; opposed to an empty arglist.
178 ((eq arglist t) nil) 178 ((eq arglist t) nil)
179 ((eq sig t) nil) ; defalias, can't check 179 ((eq sig t) nil) ; eg defalias - can't check arguments
180 ((eq sig 'err) 180 ((eq sig 'err)
181 "arglist not found") ; internal error 181 "arglist not found") ; internal error
182 ((not (equal (byte-compile-arglist-signature 182 ((not (equal (byte-compile-arglist-signature
183 arglist) 183 arglist)
184 sig)) 184 sig))