emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107166: Fix spurious recognition of


From: Alan Mackenzie
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107166: Fix spurious recognition of c-in-knr-argdecl.
Date: Tue, 07 Feb 2012 15:19:52 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107166
committer: Alan Mackenzie <address@hidden>
branch nick: cc-mode
timestamp: Tue 2012-02-07 15:19:52 +0000
message:
  Fix spurious recognition of c-in-knr-argdecl.
modified:
  lisp/ChangeLog
  lisp/progmodes/cc-engine.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-02-07 12:01:42 +0000
+++ b/lisp/ChangeLog    2012-02-07 15:19:52 +0000
@@ -1,5 +1,12 @@
 2012-02-07  Alan Mackenzie  <address@hidden>
 
+       Fix spurious recognition of c-in-knr-argdecl.
+
+       * progmodes/cc-engine.el (c-in-knr-argdecl): Check for '=' in a
+       putative K&R region.
+
+2012-02-07  Alan Mackenzie  <address@hidden>
+
        * progmodes/cc-engine.el (c-forward-objc-directive): Prevent
        looping in "#pragma mark @implementation".
 

=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el       2012-02-07 12:01:42 +0000
+++ b/lisp/progmodes/cc-engine.el       2012-02-07 15:19:52 +0000
@@ -7592,14 +7592,17 @@
     (save-restriction
       ;; If we're in a macro, our search range is restricted to it.  Narrow to
       ;; the searchable range.
-      (let* ((macro-start (c-query-macro-start))
-            (lim (max (or lim (point-min)) (or macro-start (point-min))))
+      (let* ((macro-start (save-excursion (and (c-beginning-of-macro) 
(point))))
+            (macro-end (save-excursion (and macro-start (c-end-of-macro) 
(point))))
+            (low-lim (max (or lim (point-min))   (or macro-start (point-min))))
             before-lparen after-rparen
-            (pp-count-out 20)) ; Max number of paren/brace constructs before 
we give up
-       (narrow-to-region lim (c-point 'eol))
+            (pp-count-out 20)) ; Max number of paren/brace constructs before
+                               ; we give up
+       (narrow-to-region low-lim (or macro-end (point-max)))
 
        ;; Search backwards for the defun's argument list.  We give up if we
-       ;; encounter a "}" (end of a previous defun) or BOB.
+       ;; encounter a "}" (end of a previous defun) an "=" (which can't be in
+       ;; a knr region) or BOB.
        ;;
        ;; The criterion for a paren structure being the arg list is:
        ;; o - there is non-WS stuff after it but before any "{"; AND
@@ -7619,12 +7622,13 @@
        (catch 'knr
          (while (> pp-count-out 0) ; go back one paren/bracket pair each time.
            (setq pp-count-out (1- pp-count-out))
-           (c-syntactic-skip-backward "^)]}")
+           (c-syntactic-skip-backward "^)]}=")
            (cond ((eq (char-before) ?\))
                   (setq after-rparen (point)))
                  ((eq (char-before) ?\])
                   (setq after-rparen nil))
-                 (t ; either } (hit previous defun) or no more parens/brackets
+                 (t ; either } (hit previous defun) or = or no more
+                    ; parens/brackets.
                   (throw 'knr nil)))
 
            (if after-rparen
@@ -7640,18 +7644,18 @@
                   ;; It can't be the arg list if next token is ; or {
                   (progn (goto-char after-rparen)
                          (c-forward-syntactic-ws)
-                         (not (memq (char-after) '(?\; ?\{))))
+                         (not (memq (char-after) '(?\; ?\{ ?\=))))
 
                   ;; Is the thing preceding the list an identifier (the
                   ;; function name), or a macro expansion?
                   (progn
                     (goto-char before-lparen)
                     (eq (c-backward-token-2) 0)
-                    (or (c-on-identifier)
+                    (or (eq (c-on-identifier) (point))
                         (and (eq (char-after) ?\))
                              (c-go-up-list-backward)
                              (eq (c-backward-token-2) 0)
-                             (c-on-identifier))))
+                             (eq (c-on-identifier) (point)))))
 
                   ;; Have we got a non-empty list of comma-separated
                   ;; identifiers?


reply via email to

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