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/check-declare.el,v


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/check-declare.el,v
Date: Wed, 21 Nov 2007 09:03:06 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       07/11/21 09:03:05

Index: check-declare.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/check-declare.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- check-declare.el    20 Nov 2007 03:53:23 -0000      1.3
+++ check-declare.el    21 Nov 2007 09:03:05 -0000      1.4
@@ -34,6 +34,8 @@
 
 ;; 1. Handle defstructs (eg uniquify-item-base in desktop.el).
 
+;; 2. Check C files (look in src/)?
+
 ;;; Code:
 
 (defconst check-declare-warning-buffer "*Check Declarations Warnings*"
@@ -80,6 +82,10 @@
   (let ((m (format "Checking %s..." fnfile))
         re fn sig siglist arglist type errlist)
     (message "%s" m)
+    (if (string-equal (file-name-extension fnfile) "c")
+        (progn
+          (message "%sskipping C file" m)
+          nil)
     (or (file-exists-p fnfile)
         (setq fnfile (concat fnfile ".el")))
     (if (file-exists-p fnfile)
@@ -87,17 +93,26 @@
           (insert-file-contents fnfile)
           ;; defsubst's don't _have_ to be known at compile time.
           (setq re (format "^[ \t]*(\\(def\\(?:un\\|subst\\|\
-ine-derived-mode\\)\\)\[ \t]+%s\\([ \t;]+\\|$\\)"
+ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\
+\[ \t]*%s\\([ \t;]+\\|$\\)"
                            (regexp-opt (mapcar 'cadr fnlist) t)))
           (while (re-search-forward re nil t)
             (skip-chars-forward " \t\n")
             (setq fn (match-string 2)
-                  sig (if (string-equal "define-derived-mode"
-                                        (match-string 1))
-                          '(0 . 0)
+                    sig (cond ((string-equal (match-string 1)
+                                             "define-derived-mode")
+                               '(0 . 0))
+                              ((string-equal (match-string 1)
+                                             "define-minor-mode")
+                               '(0 . 1))
+                              ;; Can't easily check alias arguments.
+                              ((string-equal (match-string 1)
+                                             "defalias")
+                               t)
+                              (t
                         (if (looking-at "\\((\\|nil\\)")
                             (byte-compile-arglist-signature
-                             (read (current-buffer)))))
+                                    (read (current-buffer))))))
                   ;; alist of functions and arglist signatures.
                   siglist (cons (cons fn sig) siglist)))))
     (dolist (e fnlist)
@@ -107,7 +122,8 @@
                 (if (setq sig (assoc (cadr e) siglist))
                     ;; Recall we use t to mean no arglist specified,
                     ;; to distinguish from an empty arglist.
-                    (unless (eq arglist t)
+                      (unless (or (eq arglist t)
+                                  (eq sig t))
                       (unless (equal (byte-compile-arglist-signature arglist)
                                      (cdr sig))
                         "arglist mismatch"))
@@ -116,7 +132,7 @@
       (when type
         (setq errlist (cons (list (car e) (cadr e) type) errlist))))
     (message "%s%s" m (if errlist "problems found" "OK"))
-    errlist))
+      errlist)))
 
 (defun check-declare-sort (alist)
   "Sort a list with elements FILE (FNFILE ...).




reply via email to

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