summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2020-02-23 07:50:33 -0800
committerGlenn Morris <rgm@gnu.org>2020-02-23 07:50:33 -0800
commiteb34c108e234c3195ae75f14ec6c5b0964f022ad (patch)
tree7f6d349aa681071783b493bbdfd99d79c1c1b975 /lisp/progmodes
parent4332964861a5a36a7f20daa2eeadab3bb5737193 (diff)
parentba7004b2a74c69450114c12ef4521768fc165e8e (diff)
downloademacs-eb34c108e234c3195ae75f14ec6c5b0964f022ad.tar.gz
Merge from origin/emacs-27
ba7004b2a7 (origin/emacs-27) Shorten some ppss struct field names 693749c60f Java Mode: Fix fontification of variable decl inside `for' 884b68ca2c CC Mode: Fontify foo in "const auto foo :" correctly # Conflicts: # etc/NEWS
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-engine.el30
1 files changed, 25 insertions, 5 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 0c338fa3868..bccef6890f8 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -9034,7 +9034,7 @@ point unchanged and return nil."
(if (looking-at c-:-op-cont-regexp)
(progn (goto-char (match-end 0)) t)
(not
- (and (c-major-mode-is 'c++-mode)
+ (and (c-major-mode-is '(c++-mode java-mode))
(save-excursion
(and
(c-go-up-list-backward)
@@ -9275,9 +9275,10 @@ This function might do hidden buffer changes."
;;
;; The third element of the return value is non-nil when the declaration
;; parsed might be an expression. The fourth element is the position of
- ;; the start of the type identifier. The fifth element is t if either
- ;; CONTEXT was 'top, or the declaration is detected to be treated as top
- ;; level (e.g. with the keyword "extern").
+ ;; the start of the type identifier, or the same as the first element when
+ ;; there is no type identifier. The fifth element is t if either CONTEXT
+ ;; was 'top, or the declaration is detected to be treated as top level
+ ;; (e.g. with the keyword "extern").
;;
;; If a cast is parsed:
;;
@@ -9680,7 +9681,26 @@ This function might do hidden buffer changes."
(setq got-identifier (c-forward-name))
(setq name-start pos))
(when (looking-at "[0-9]")
- (setq got-number t))) ; We've probably got an arithmetic expression.
+ (setq got-number t)) ; We probably have an arithmetic expression.
+ (and maybe-typeless
+ (or (eq at-type 'maybe)
+ (when (eq at-type 'found)
+ ;; Remove the ostensible type from the found types list.
+ (when type-start
+ (c-unfind-type
+ (buffer-substring-no-properties
+ type-start
+ (save-excursion
+ (goto-char type-start)
+ (c-end-of-token)
+ (point)))))
+ t))
+ ;; The token which we assumed to be a type is actually the
+ ;; identifier, and we have no explicit type.
+ (setq at-type nil
+ name-start type-start
+ id-start type-start
+ got-identifier t)))
;; Skip over type decl suffix operators and trailing noise macros.
(while