From 9e54c5250d87e64a4a7f2423f217c4444bcf3449 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sun, 3 Jul 2016 18:13:51 +0000 Subject: [PATCH] Remove redundant forms from CC Mode for faster fontification * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Remove four arms of the "main" cond form in the function, which have been redundant since the extraction of c-font-lock-cut-off-declarators from the function on 2016-06-15/16. --- lisp/progmodes/cc-fonts.el | 44 -------------------------------------- 1 file changed, 44 deletions(-) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index f122a95feb..dfc2c06121 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1403,50 +1403,6 @@ casts and declarations are fontified. Used on level 2 and higher." (c-fontify-recorded-types-and-refs) nil)) - ;; Restore point, since at this point in the code it has been - ;; left undefined by c-forward-decl-or-cast-1 above. - ((progn (goto-char start-pos) nil)) - - ;; If point is inside a bracelist, there's no point checking it - ;; being at a declarator. - ((let ((paren-state (c-parse-state))) - (setq lbrace (c-cheap-inside-bracelist-p paren-state))) - ;; Move past this bracelist to prevent an endless loop. - (goto-char lbrace) - (unless (c-safe (progn (forward-list) t)) - (goto-char start-pos) - (c-forward-token-2)) - nil) - - ;; If point is just after a ")" which is followed by an - ;; identifier which isn't a label, or at the matching "(", we're - ;; at either a macro invocation, a cast, or a - ;; for/while/etc. statement. The cast case is handled above. - ;; None of these cases can contain a declarator. - ((or (and (eq (char-before match-pos) ?\)) - (c-on-identifier) - (save-excursion (not (c-forward-label)))) - (and (eq (char-after) ?\() - (save-excursion - (and - (progn (c-backward-token-2) (c-on-identifier)) - (save-excursion (not (c-forward-label))) - (progn (c-backward-token-2) - (eq (char-after) ?\()))))) - (c-forward-token-2) ; Must prevent looping. - nil) - - ((and (not c-enums-contain-decls) - ;; An optimization quickly to eliminate scans of long enum - ;; declarations in the next cond arm. - (let ((paren-state (c-parse-state))) - (and - (numberp (car paren-state)) - (save-excursion - (goto-char (car paren-state)) - (c-backward-over-enum-header))))) - (c-forward-token-2) - nil) (t t))) ;; It was a false alarm. Check if we're in a label (or other -- 2.39.2