diff options
author | Alan Mackenzie <acm@muc.de> | 2022-11-25 09:49:02 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2022-11-25 09:49:02 +0000 |
commit | 639adf26a1b43445eaf52e4246cf1f5b46b5e12d (patch) | |
tree | a1aedc78cff6111c4aba33142fb6536617840e42 /lisp/progmodes | |
parent | a7f8087d7fc995e41b4cd6143e5833e6e3a9dac4 (diff) | |
download | emacs-639adf26a1b43445eaf52e4246cf1f5b46b5e12d.tar.gz emacs-639adf26a1b43445eaf52e4246cf1f5b46b5e12d.tar.bz2 emacs-639adf26a1b43445eaf52e4246cf1f5b46b5e12d.zip |
CC Mode: Fix the "asymmetry rule" for fontifying a type followed by *
This fixes bug #59427. We now handle correctly the case when a parenthesis
follows the * which is ambiguously a multiplication or indirection operator.
Also, we don't recognise a type thus found as a found type - the evidence is
too weak.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Fix CASE 17.5 as
above.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/cc-engine.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 9e09e5150d9..11ddb39ed91 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -11077,8 +11077,9 @@ This function might do hidden buffer changes." at-decl-start)) (let ((space-before-id (save-excursion - (goto-char name-start) - (or (bolp) (memq (char-before) '(?\ ?\t))))) + (goto-char id-start) ; Position of "*". + (and (> (skip-chars-forward "* \t\n\r") 0) + (memq (char-before) '(?\ ?\t ?\n ?\r))))) (space-after-type (save-excursion (goto-char type-start) @@ -11088,6 +11089,8 @@ This function might do hidden buffer changes." (memq (char-after) '(?\ ?\t))))))) (when (not (eq (not space-before-id) (not space-after-type))) + (when (eq at-type 'maybe) + (setq unsafe-maybe t)) (setq maybe-expression t) (throw 'at-decl-or-cast t))))) |