summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-langs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2022-11-17 10:34:41 +0000
committerAlan Mackenzie <acm@muc.de>2022-11-17 10:36:59 +0000
commitca3cc92e14a6bdaf6fb817fff9e633f30d461359 (patch)
tree81248fd8333c83d08eec5d655bf3c8dbfd82bfd1 /lisp/progmodes/cc-langs.el
parent5df1fd19baddb811ab358b6f1358d4b6fad434a2 (diff)
downloademacs-ca3cc92e14a6bdaf6fb817fff9e633f30d461359.tar.gz
emacs-ca3cc92e14a6bdaf6fb817fff9e633f30d461359.tar.bz2
emacs-ca3cc92e14a6bdaf6fb817fff9e633f30d461359.zip
CC Mode: Make implicit int types following specifiers fontify correctly
This fixes bug #59267. It applies to C Mode only, and refers to constructs like "register count;" which are implicitly of int type. * lisp/progmodes/cc-engine.el (c-forward-type): Use the new regexp c-maybe-typeless-specifier-re in place of c-opt-type-modifier-prefix-key. Add an extra arm to the main cond form to handle the construct, and another to handle "extern "C" foo_t my_foo;". (c-forward-decl-or-cast-1): Adapt to handle the result no-id from c-forward-type. * lisp/progmodes/cc-langs.el (c-maybe-typeless-specifier-re): New lang const/var.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r--lisp/progmodes/cc-langs.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 291af038b79..94c84a6a702 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -3869,6 +3869,14 @@ possible for good performance."
t)
"\\>")))
+(c-lang-defconst c-maybe-typeless-specifier-re
+ "Regexp matching keywords which might, but needn't, declare variables with
+no explicit type given, or nil in languages without such specifiers."
+ t (c-lang-const c-opt-type-modifier-prefix-key)
+ c (c-lang-const c-type-decl-prefix-keywords-key))
+(c-lang-defvar c-maybe-typeless-specifier-re
+ (c-lang-const c-maybe-typeless-specifier-re))
+
(c-lang-defconst c-type-decl-prefix-key
"Regexp matching any declarator operator that might precede the
identifier in a declaration, e.g. the \"*\" in \"char *argv\". This