Fix up comment convention on the arch-tag lines.
[bpt/emacs.git] / lisp / progmodes / cc-engine.el
index 929b000..d5a3103 100644 (file)
@@ -81,8 +81,9 @@
 ;; assume that these text properties are used as described here.
 ;;
 ;; 'syntax-table
-;;   Used to modify the syntax of some characters.  Currently used to
-;;   mark the "<" and ">" of angle bracket parens with paren syntax.
+;;   Used to modify the syntax of some characters.  It is used to
+;;   mark the "<" and ">" of angle bracket parens with paren syntax, and
+;;   to "hide" obtrusive characters in preprocessor lines.
 ;;
 ;;   This property is used on single characters and is therefore
 ;;   always treated as front and rear nonsticky (or start and end open
@@ -4035,6 +4036,9 @@ comment at the start of cc-engine.el for more info."
              c-found-types)
     (sort type-list 'string-lessp)))
 
+;; Shut up the byte compiler.
+(defvar c-maybe-stale-found-type)
+
 (defun c-trim-found-types (beg end old-len)
   ;; An after change function which, in conjunction with the info in
   ;; c-maybe-stale-found-type (set in c-before-change), removes a type
@@ -6332,7 +6336,8 @@ comment at the start of cc-engine.el for more info."
       ;; the searchable range.
       (let* ((macro-start (c-query-macro-start))
             (lim (max (or lim (point-min)) (or macro-start (point-min))))
-            before-lparen after-rparen)
+            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))
 
        ;; Search backwards for the defun's argument list.  We give up if we
@@ -6354,7 +6359,8 @@ comment at the start of cc-engine.el for more info."
        ;; {
 
        (catch 'knr
-         (while t ; go round one paren/bracket construct each time round.
+         (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 "^)]}")
            (cond ((eq (char-before) ?\))
                   (setq after-rparen (point)))
@@ -8030,12 +8036,15 @@ comment at the start of cc-engine.el for more info."
 
             ;; CASE 5A.5: ordinary defun open
             (t
-             (goto-char placeholder)
-             (if (or containing-decl-open macro-start)
-                 (c-add-syntax 'defun-open (c-point 'boi))
-               ;; Bogus to use bol here, but it's the legacy.
-               (c-add-syntax 'defun-open (c-point 'bol)))
-             )))
+             (save-excursion
+               (c-beginning-of-decl-1 lim)
+               (while (looking-at c-specifier-key)
+                 (goto-char (match-end 1))
+                 (c-forward-syntactic-ws indent-point))
+               (c-add-syntax 'defun-open (c-point 'boi))
+               ;; Bogus to use bol here, but it's the legacy.  (Resolved,
+               ;; 2007-11-09)
+               ))))
 
           ;; CASE 5B: After a function header but before the body (or
           ;; the ending semicolon if there's no body).
@@ -9208,5 +9217,5 @@ Cannot combine absolute offsets %S and %S in `add' method"
 \f
 (cc-provide 'cc-engine)
 
-;;; arch-tag: 149add18-4673-4da5-ac47-6805e4eae089
+;; arch-tag: 149add18-4673-4da5-ac47-6805e4eae089
 ;;; cc-engine.el ends here