1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/73e4dec237e8/
Changeset: 73e4dec237e8
User: acm
Date: 2017-11-21 17:53:20+00:00
Summary: Make c-defun-name analyze more thoroughly a function type which is a struct
This fixes bug #29293.
* cc-cmds.el (c-defun-name): When a struct (etc.) type is encountered, check
whether it is the return type of a function rather than a declaration of the
struct itself. Similarly adapt the cond arm which deals with functions
properly to recognize struct return types.
Affected #: 1 file
diff -r f30859593cbf2f12da6fbd1827786a87b123ab2d -r
73e4dec237e8ae7a2ce08cc9f788c141e90e13db cc-cmds.el
--- a/cc-cmds.el
+++ b/cc-cmds.el
@@ -1804,7 +1804,15 @@
;; Pick out the defun name, according to the type of defun.
(cond
;; struct, union, enum, or similar:
- ((looking-at c-type-prefix-key)
+ ((save-excursion
+ (and
+ (looking-at c-type-prefix-key)
+ (consp (c-forward-decl-or-cast-1 (c-point 'bosws) 'top nil))
+ (or (not (or (eq (char-after) ?{)
+ (and c-recognize-knr-p
+ (c-in-knr-argdecl))))
+ (progn (c-backward-syntactic-ws)
+ (not (eq (char-before) ?\)))))))
(let ((key-pos (point)))
(c-forward-over-token-and-ws) ; over "struct ".
(cond
@@ -1834,8 +1842,16 @@
(t
;; Normal function or initializer.
- (when (c-syntactic-re-search-forward "[{(]" nil t)
- (backward-char)
+ (when
+ (and
+ (consp (c-forward-decl-or-cast-1 (c-point 'bosws) 'top nil))
+ (or (eq (char-after) ?{)
+ (and c-recognize-knr-p
+ (c-in-knr-argdecl)))
+ (progn
+ (c-backward-syntactic-ws)
+ (eq (char-before) ?\)))
+ (c-go-list-backward))
(c-backward-syntactic-ws)
(when (eq (char-before) ?\=) ; struct foo bar = {0, 0} ;
(c-backward-token-2)
Repository URL:
https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.