]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-fonts.el
Update copyright year to 2015
[gnu-emacs] / lisp / progmodes / cc-fonts.el
index 1c389bc36656fc3c55a874b4d662bf23a6e536db..9a1273ddcce09f9fbdac86d8309949ca0c8a419a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cc-fonts.el --- font lock support for CC Mode
 
-;; Copyright (C) 2002-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2015 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             2002- Martin Stjernholm
     ;; This function might do hidden buffer changes.
     (when (c-got-face-at (point) c-literal-faces)
       (while (progn
-              (goto-char (next-single-property-change
+              (goto-char (c-next-single-property-change
                           (point) 'face nil limit))
               (and (< (point) limit)
                    (c-got-face-at (point) c-literal-faces))))
@@ -559,8 +559,7 @@ stuff.  Used on level 1 and higher."
                                   (progn
                                     (c-mark-<-as-paren beg)
                                     (c-mark->-as-paren end))
-                                ;; (c-clear-char-property beg 'syntax-table)
-                                (c-clear-char-property beg 'category)))
+                                (c-unmark-<->-as-paren beg)))
                             nil)))))))
 
              ;; #define.
@@ -1255,6 +1254,8 @@ casts and declarations are fontified.  Used on level 2 and higher."
        c-font-lock-maybe-decl-faces
 
        (lambda (match-pos inside-macro)
+        ;; Note to maintainers: don't use `limit' inside this lambda form;
+        ;; c-find-decl-spots sometimes narrows to less than `limit'.
         (setq start-pos (point))
         (when
          ;; The result of the form below is true when we don't recognize a
@@ -1463,36 +1464,38 @@ casts and declarations are fontified.  Used on level 2 and higher."
                    c-recognize-knr-p) ; Strictly speaking, bogus, but it
                                       ; speeds up lisp.h tremendously.
                (save-excursion
-                 (unless (or (eobp)
-                             (looking-at "\\s(\\|\\s)"))
-                   (forward-char))
-                 (setq bod-res (car (c-beginning-of-decl-1 decl-search-lim)))
-                 (if (and (eq bod-res 'same)
-                          (save-excursion
-                            (c-backward-syntactic-ws)
-                            (eq (char-before) ?\})))
-                     (c-beginning-of-decl-1 decl-search-lim))
-
-                 ;; We're now putatively at the declaration.
-                 (setq paren-state (c-parse-state))
-                 ;; At top level or inside a "{"?
-                 (if (or (not (setq encl-pos
-                                    (c-most-enclosing-brace paren-state)))
-                         (eq (char-after encl-pos) ?\{))
-                     (progn
-                       (when (looking-at c-typedef-key) ; "typedef"
-                         (setq is-typedef t)
-                         (goto-char (match-end 0))
-                         (c-forward-syntactic-ws))
-                       ;; At a real declaration?
-                       (if (memq (c-forward-type t) '(t known found decltype))
-                           (progn
-                             (c-font-lock-declarators limit t is-typedef)
-                             nil)
-                         ;; False alarm.  Return t to go on to the next check.
-                         (goto-char start-pos)
-                         t))
-                   t))))))
+                 (if (c-back-over-member-initializers)
+                    t                  ; Can't be at a declarator
+                   (unless (or (eobp)
+                               (looking-at "\\s(\\|\\s)"))
+                     (forward-char))
+                   (setq bod-res (car (c-beginning-of-decl-1 decl-search-lim)))
+                   (if (and (eq bod-res 'same)
+                            (save-excursion
+                              (c-backward-syntactic-ws)
+                              (eq (char-before) ?\})))
+                       (c-beginning-of-decl-1 decl-search-lim))
+
+                   ;; We're now putatively at the declaration.
+                   (setq paren-state (c-parse-state))
+                   ;; At top level or inside a "{"?
+                   (if (or (not (setq encl-pos
+                                      (c-most-enclosing-brace paren-state)))
+                           (eq (char-after encl-pos) ?\{))
+                       (progn
+                         (when (looking-at c-typedef-key) ; "typedef"
+                           (setq is-typedef t)
+                           (goto-char (match-end 0))
+                           (c-forward-syntactic-ws))
+                         ;; At a real declaration?
+                         (if (memq (c-forward-type t) '(t known found decltype))
+                             (progn
+                               (c-font-lock-declarators (point-max) t is-typedef)
+                               nil)
+                           ;; False alarm.  Return t to go on to the next check.
+                           (goto-char start-pos)
+                           t))
+                     t)))))))
 
          ;; It was a false alarm.  Check if we're in a label (or other
          ;; construct with `:' except bitfield) instead.
@@ -2700,4 +2703,8 @@ need for `pike-font-lock-extra-types'.")
 ;; 2006-07-10:  awk-font-lock-keywords has been moved back to cc-awk.el.
 (cc-provide 'cc-fonts)
 
+;;; Local Variables:
+;;; indent-tabs-mode: t
+;;; tab-width: 8
+;;; End:
 ;;; cc-fonts.el ends here