]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-engine.el
Merge changes from emacs-23 branch
[gnu-emacs] / lisp / progmodes / cc-engine.el
index 18010407eda3b3f451b42f94833574acc6bad77c..f90d29bf00946cb1da028ddcdfccc59d35fa291e 100644 (file)
@@ -1,8 +1,6 @@
 ;;; cc-engine.el --- core syntax guessing engine for CC mode
 
-;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-;;   2010  Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2011  Free Software Foundation, Inc.
 
 ;; Authors:    2001- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -5373,6 +5371,8 @@ comment at the start of cc-engine.el for more info."
 ;; cc-mode requires cc-fonts.
 (declare-function c-fontify-recorded-types-and-refs "cc-fonts" ())
 
+(defvar c-forward-<>-arglist-recur-depth)
+
 (defun c-forward-<>-arglist (all-types)
   ;; The point is assumed to be at a "<".  Try to treat it as the open
   ;; paren of an angle bracket arglist and move forward to the
@@ -5398,7 +5398,8 @@ comment at the start of cc-engine.el for more info."
        ;; If `c-record-type-identifiers' is set then activate
        ;; recording of any found types that constitute an argument in
        ;; the arglist.
-       (c-record-found-types (if c-record-type-identifiers t)))
+       (c-record-found-types (if c-record-type-identifiers t))
+       (c-forward-<>-arglist-recur--depth 0))
     (if (catch 'angle-bracket-arglist-escape
          (setq c-record-found-types
                (c-forward-<>-arglist-recur all-types)))
@@ -5415,6 +5416,14 @@ comment at the start of cc-engine.el for more info."
       nil)))
 
 (defun c-forward-<>-arglist-recur (all-types)
+
+  ;; Temporary workaround for Bug#7722.
+  (when (boundp 'c-forward-<>-arglist-recur--depth)
+    (if (> c-forward-<>-arglist-recur--depth 200)
+       (error "Max recursion depth reached in <> arglist")
+      (setq c-forward-<>-arglist-recur--depth
+           (1+ c-forward-<>-arglist-recur--depth))))
+
   ;; Recursive part of `c-forward-<>-arglist'.
   ;;
   ;; This function might do hidden buffer changes.
@@ -5846,7 +5855,8 @@ comment at the start of cc-engine.el for more info."
   ;; `c-record-type-identifiers' is non-nil.
   ;;
   ;; This function might do hidden buffer changes.
-  (when (looking-at "<")
+  (when (and c-recognize-<>-arglists
+            (looking-at "<"))
     (c-forward-<>-arglist t)
     (c-forward-syntactic-ws))
 
@@ -10336,5 +10346,4 @@ Cannot combine absolute offsets %S and %S in `add' method"
 \f
 (cc-provide 'cc-engine)
 
-;; arch-tag: 149add18-4673-4da5-ac47-6805e4eae089
 ;;; cc-engine.el ends here