diff options
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
-rw-r--r-- | lisp/progmodes/cc-engine.el | 71 |
1 files changed, 26 insertions, 45 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 75e2f0d21f5..252eec138c1 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -2705,7 +2705,7 @@ comment at the start of cc-engine.el for more info." (if (and (consp elt) (>= (length elt) 3)) ;; Inside a string or comment (let ((depth 0) (containing nil) (last nil) - in-string in-comment (after-quote nil) + in-string in-comment (min-depth 0) com-style com-str-start (intermediate nil) (char-1 (nth 3 elt)) ; first char of poss. 2-char construct (pos (car elt)) @@ -3024,7 +3024,7 @@ comment at the start of cc-engine.el for more info." (defun c-full-trim-near-cache () ;; Remove stale entries in `c-full-lit-near-cache', i.e. those whose END ;; entries, or positions, are above `c-full-near-cache-limit'. - (let ((nc-list c-full-lit-near-cache) elt) + (let ((nc-list c-full-lit-near-cache)) (while nc-list (let ((elt (car nc-list))) (if (if (car (cddr elt)) @@ -7625,8 +7625,7 @@ comment at the start of cc-engine.el for more info." ;; entire raw string (when properly terminated) or just the delimiter ;; (otherwise). In either of these cases, return t, otherwise return nil. ;; - (let ((here (point)) - in-macro macro-end id Rquote found) + (let (in-macro macro-end) (when (and (eq (char-before (1- (point))) ?R) @@ -9377,8 +9376,8 @@ This function might do hidden buffer changes." maybe-typeless ;; Save the value of kwd-sym between loops of the "Check for a ;; type" loop. Needed to distinguish a C++11 "auto" from a pre - ;; C++11 one. - prev-kwd-sym + ;; C++11 one. (Commented out, 2020-11-01). + ;; prev-kwd-sym ;; If a specifier is found that also can be a type prefix, ;; these flags are set instead of those above. If we need to ;; back up an identifier, they are copied to the real flag @@ -9537,7 +9536,7 @@ This function might do hidden buffer changes." ;; specifier keyword and we know we're in a ;; declaration. (setq at-decl-or-cast t) - (setq prev-kwd-sym kwd-sym) + ;; (setq prev-kwd-sym kwd-sym) (goto-char kwd-clause-end)))) @@ -11252,7 +11251,7 @@ comment at the start of cc-engine.el for more info." (c-syntactic-re-search-forward ";" nil 'move t))) nil))) -(defun c-looking-at-decl-block (_containing-sexp goto-start &optional limit) +(defun c-looking-at-decl-block (goto-start &optional limit) ;; Assuming the point is at an open brace, check if it starts a ;; block that contains another declaration level, i.e. that isn't a ;; statement block or a brace list, and if so return non-nil. @@ -11432,9 +11431,7 @@ comment at the start of cc-engine.el for more info." ; *c-looking-at-decl-block ; containing-sexp goto-start &optional ; limit) - (when (and (c-looking-at-decl-block - (c-pull-open-brace paren-state) - nil) + (when (and (c-looking-at-decl-block nil) (looking-at c-class-key)) (goto-char (match-end 1)) (c-forward-syntactic-ws) @@ -11453,9 +11450,7 @@ comment at the start of cc-engine.el for more info." (save-excursion (goto-char open-paren-pos) (when (and (eq (char-after) ?{) - (c-looking-at-decl-block - (c-safe-position open-paren-pos paren-state) - nil)) + (c-looking-at-decl-block nil)) (back-to-indentation) (vector (point) open-paren-pos)))))) @@ -11468,7 +11463,7 @@ comment at the start of cc-engine.el for more info." (while (and open-brace (save-excursion (goto-char open-brace) - (not (c-looking-at-decl-block next-open-brace nil)))) + (not (c-looking-at-decl-block nil)))) (setq open-brace next-open-brace next-open-brace (c-pull-open-brace paren-state))) open-brace)) @@ -11786,7 +11781,7 @@ comment at the start of cc-engine.el for more info." (goto-char (car res)) (c-do-declarators (point-max) t nil nil - (lambda (id-start id-end tok not-top func init) + (lambda (id-start _id-end _tok _not-top _func _init) (cond ((> id-start after-type-id-pos) (throw 'find-decl nil)) @@ -11876,7 +11871,7 @@ comment at the start of cc-engine.el for more info." (or accept-in-paren (not (eq (cdr bufpos) 'in-paren))) (car bufpos)))))) -(defun c-looking-at-special-brace-list (&optional _lim) +(defun c-looking-at-special-brace-list () ;; If we're looking at the start of a pike-style list, i.e., `({ })', ;; `([ ])', `(< >)', etc., a cons of a cons of its starting and ending ;; positions and its entry in c-special-brace-lists is returned, nil @@ -12506,8 +12501,7 @@ comment at the start of cc-engine.el for more info." (defun c-add-class-syntax (symbol containing-decl-open containing-decl-start - containing-decl-kwd - _paren-state) + containing-decl-kwd) ;; The inclass and class-close syntactic symbols are added in ;; several places and some work is needed to fix everything. ;; Therefore it's collected here. @@ -12556,7 +12550,7 @@ comment at the start of cc-engine.el for more info." ;; CASE B.1: class-open ((save-excursion (and (eq (char-after) ?{) - (c-looking-at-decl-block containing-sexp t) + (c-looking-at-decl-block t) (setq beg-of-same-or-containing-stmt (point)))) (c-add-syntax 'class-open beg-of-same-or-containing-stmt)) @@ -12759,10 +12753,7 @@ comment at the start of cc-engine.el for more info." (goto-char containing-sexp) (eq (char-after) ?{)) (setq placeholder - (c-looking-at-decl-block - (c-most-enclosing-brace paren-state - containing-sexp) - t))) + (c-looking-at-decl-block t))) (setq containing-decl-open containing-sexp containing-decl-start (point) containing-sexp nil) @@ -13004,8 +12995,7 @@ comment at the start of cc-engine.el for more info." (setq placeholder (c-add-class-syntax 'inclass containing-decl-open containing-decl-start - containing-decl-kwd - paren-state)) + containing-decl-kwd)) ;; Append access-label with the same anchor point as ;; inclass gets. (c-append-syntax 'access-label placeholder)) @@ -13077,7 +13067,7 @@ comment at the start of cc-engine.el for more info." ((save-excursion (let (tmp) (and (eq char-after-ip ?{) - (setq tmp (c-looking-at-decl-block containing-sexp t)) + (setq tmp (c-looking-at-decl-block t)) (progn (setq placeholder (point)) (goto-char tmp) @@ -13098,7 +13088,7 @@ comment at the start of cc-engine.el for more info." (goto-char indent-point) (skip-chars-forward " \t") (and (eq (char-after) ?{) - (c-looking-at-decl-block containing-sexp t) + (c-looking-at-decl-block t) (setq placeholder (point)))) (c-add-syntax 'class-open placeholder)) @@ -13138,8 +13128,7 @@ comment at the start of cc-engine.el for more info." (c-add-class-syntax 'inclass containing-decl-open containing-decl-start - containing-decl-kwd - paren-state)) + containing-decl-kwd)) ;; CASE 5A.5: ordinary defun open (t @@ -13202,8 +13191,7 @@ comment at the start of cc-engine.el for more info." (c-add-class-syntax 'inclass containing-decl-open containing-decl-start - containing-decl-kwd - paren-state))) + containing-decl-kwd))) ;; CASE 5B.4: Nether region after a C++ or Java func ;; decl, which could include a `throws' declaration. @@ -13273,8 +13261,7 @@ comment at the start of cc-engine.el for more info." (c-add-class-syntax 'inclass containing-decl-open containing-decl-start - containing-decl-kwd - paren-state))) + containing-decl-kwd))) ;; CASE 5C.3: in a Java implements/extends (injava-inher @@ -13460,8 +13447,7 @@ comment at the start of cc-engine.el for more info." (c-add-class-syntax 'class-close containing-decl-open containing-decl-start - containing-decl-kwd - paren-state)) + containing-decl-kwd)) ;; CASE 5H: we could be looking at subsequent knr-argdecls ((and c-recognize-knr-p @@ -13582,8 +13568,7 @@ comment at the start of cc-engine.el for more info." (c-add-class-syntax 'inclass containing-decl-open containing-decl-start - containing-decl-kwd - paren-state))) + containing-decl-kwd))) (when (and c-syntactic-indentation-in-macros macro-start (/= macro-start (c-point 'boi indent-point))) @@ -13899,7 +13884,7 @@ comment at the start of cc-engine.el for more info." (save-excursion (goto-char indent-point) (c-forward-syntactic-ws (c-point 'eol)) - (c-looking-at-special-brace-list (point))))) + (c-looking-at-special-brace-list)))) (c-add-syntax 'brace-entry-open (point)) (c-add-stmt-syntax 'brace-list-entry nil t containing-sexp paren-state (point)) @@ -13965,9 +13950,7 @@ comment at the start of cc-engine.el for more info." (and lim (progn (goto-char lim) - (c-looking-at-decl-block - (c-most-enclosing-brace paren-state lim) - nil)) + (c-looking-at-decl-block nil)) (setq placeholder (point)))) (c-backward-to-decl-anchor lim) (back-to-indentation) @@ -14135,9 +14118,7 @@ comment at the start of cc-engine.el for more info." (and (progn (goto-char placeholder) (eq (char-after) ?{)) - (c-looking-at-decl-block (c-most-enclosing-brace - paren-state (point)) - nil)))) + (c-looking-at-decl-block nil)))) (c-backward-to-decl-anchor lim) (back-to-indentation) (c-add-syntax 'defun-block-intro (point))) |