diff options
author | Alan Mackenzie <acm@muc.de> | 2017-10-04 17:34:27 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2017-10-04 17:34:27 +0000 |
commit | 4e0b67ed27114fa2cbebca32567089fd8fa78425 (patch) | |
tree | 278d6df6528d9ced3b602a43bae83052bbbf5f81 /lisp/progmodes/cc-mode.el | |
parent | 0b558b4acb8326c6f26fcde47ca85777716ae831 (diff) | |
download | emacs-4e0b67ed27114fa2cbebca32567089fd8fa78425.tar.gz emacs-4e0b67ed27114fa2cbebca32567089fd8fa78425.tar.bz2 emacs-4e0b67ed27114fa2cbebca32567089fd8fa78425.zip |
Fontify untyped function declarations in C Mode correctly.
Also correct two bugs where deleting WS at a BOL could leave an untyped
function declaration unfontified.
* lisp/progmodes/cc-engine.el (c-find-decl-spots): Don't set the flag
"top-level" when we're in a macro.
(c-forward-decl-or-cast-1): Recognize top-level "foo(bar)" or "foo()" in C
Mode as a implicitly typed function declaration.
(c-just-after-func-arglist-p): Don't get confused by "defined (foo)" inside a
macro. It's not a function plus arglist.
* lisp/progmodes/cc-langs.el (c-cpp-expr-functions-key): New defconst and
defvar.
* lisp/progmodes/cc-mode.el (c-fl-decl-end): After c-forward-declarator, move
over any following parenthesis expression (i.e. parameter list).
(c-change-expand-fl-region): When c-new-END is at a BOL, include that line in
the returned region, to cope with deletions at column 0.
Diffstat (limited to 'lisp/progmodes/cc-mode.el')
-rw-r--r-- | lisp/progmodes/cc-mode.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 8867453e85c..b0e5fe47a7c 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1571,6 +1571,8 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (and (c-beginning-of-macro) (progn (c-end-of-macro) (point)))))) (when (and (c-forward-declarator lim) + (or (not (eq (char-after) ?\()) + (c-go-list-forward nil lim)) (eq (c-forward-token-2 1 nil lim) 0)) (c-backward-syntactic-ws) (point)))))) @@ -1589,7 +1591,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG)) c-new-END (or (c-fl-decl-end c-new-END) - (c-point 'bonl (max (1- c-new-END) (point-min))))))) + (c-point 'bonl c-new-END))))) (defun c-context-expand-fl-region (beg end) ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a |