mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-03 14:10:47 -08:00
CC Mode: fix many compiler warnings which would appear with lexical binding
* lisp/progmodes/cc-align.el (three places) prefix langelem with a _.
* lisp/progmodes/cc-{cmds,engine}.el: Remove superfluous local variables.
* lisp/progmodes/cc-defs.el (c-will-be-unescaped): Remove unused parameter
end.
* lisp/progmodes/cc-engine.el (c-looking-at-decl-block): Remove unused
parameter containing-sexp.
(c-looking-at-special-brace-list); Remove unused parameter lim.
(c-add-class-syntax): Remove unused parameter paren-state.
This commit is contained in:
parent
8ece715af6
commit
ae3904bb5d
5 changed files with 33 additions and 54 deletions
|
|
@ -1115,7 +1115,7 @@ arglist-cont."
|
|||
(vector (+ (current-column) c-basic-offset))))
|
||||
(vector 0)))))
|
||||
|
||||
(defun c-lineup-2nd-brace-entry-in-arglist (langelem)
|
||||
(defun c-lineup-2nd-brace-entry-in-arglist (_langelem)
|
||||
"Lineup the second entry of a brace block under the first, when the first
|
||||
line is also contained in an arglist or an enclosing brace ON THAT LINE.
|
||||
|
||||
|
|
@ -1156,7 +1156,7 @@ Works with brace-list-intro."
|
|||
(eq (char-after) ?{))))
|
||||
'c-lineup-arglist-intro-after-paren))
|
||||
|
||||
(defun c-lineup-class-decl-init-+ (langelem)
|
||||
(defun c-lineup-class-decl-init-+ (_langelem)
|
||||
"Line up the second entry of a class (etc.) initializer c-basic-offset
|
||||
characters in from the identifier when:
|
||||
\(i) The type is a class, struct, union, etc. (but not an enum);
|
||||
|
|
@ -1197,7 +1197,7 @@ Works with: brace-list-intro."
|
|||
(eq (point) init-pos)
|
||||
(vector (+ (current-column) c-basic-offset)))))))
|
||||
|
||||
(defun c-lineup-class-decl-init-after-brace (langelem)
|
||||
(defun c-lineup-class-decl-init-after-brace (_langelem)
|
||||
"Line up the second entry of a class (etc.) initializer after its opening
|
||||
brace when:
|
||||
\(i) The type is a class, struct, union, etc. (but not an enum);
|
||||
|
|
|
|||
|
|
@ -907,7 +907,6 @@ settings of `c-cleanup-list' are done."
|
|||
(when (and (boundp 'electric-pair-mode)
|
||||
electric-pair-mode)
|
||||
(let ((size (buffer-size))
|
||||
(c-in-electric-pair-functionality t)
|
||||
post-self-insert-hook)
|
||||
(electric-pair-post-self-insert-function)
|
||||
(setq got-pair-} (and at-eol
|
||||
|
|
@ -2327,7 +2326,7 @@ with a brace block, at the outermost level of nesting."
|
|||
(c-save-buffer-state ((paren-state (c-parse-state))
|
||||
(orig-point-min (point-min))
|
||||
(orig-point-max (point-max))
|
||||
lim name where limits fdoc)
|
||||
lim name limits where)
|
||||
(setq lim (c-widen-to-enclosing-decl-scope
|
||||
paren-state orig-point-min orig-point-max))
|
||||
(and lim (setq lim (1- lim)))
|
||||
|
|
|
|||
|
|
@ -434,9 +434,8 @@ to it is returned. This function does not modify the point or the mark."
|
|||
(setq count (+ count (skip-chars-backward "\\\\"))))
|
||||
(not (zerop (logand count 1))))))
|
||||
|
||||
(defmacro c-will-be-unescaped (beg end)
|
||||
;; Would the character after END be unescaped after the removal of (BEG END)?
|
||||
;; This is regardless of its current status. It is assumed that (>= POS END).
|
||||
(defmacro c-will-be-unescaped (beg)
|
||||
;; Would the character after BEG be unescaped?
|
||||
`(save-excursion
|
||||
(let (count)
|
||||
(goto-char ,beg)
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -1482,7 +1482,7 @@ Note that the style variables are always made local to the buffer."
|
|||
((and
|
||||
(c-is-escaped end)
|
||||
(or (eq beg end) ; .... by inserting stuff between \ and \n?
|
||||
(c-will-be-unescaped beg end))) ; ... by removing an odd number of \s?
|
||||
(c-will-be-unescaped beg))) ; ... by removing an odd number of \s?
|
||||
(goto-char (1+ end))) ; To after the NL which is being unescaped.
|
||||
(t
|
||||
(goto-char end)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue