GNU bug report logs - #59671
CC Mode 5.35.2 (C/*l); More incorrect type recognition

Previous Next

Package: cc-mode;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Tue, 29 Nov 2022 07:09:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59671 <at> debbugs.gnu.org
Subject: bug#59671: CC Mode 5.35.2 (C/*l); More incorrect type recognition
Date: Thu, 8 Dec 2022 19:00:04 +0000
[Message part 1 (text/plain, inline)]
Hello, Po.

On Tue, Nov 29, 2022 at 15:08:15 +0800, Po Lu via CC-Mode-help wrote:
> Package: cc-mode

> Insert the following code in a buffer:

> /* fns.c -- generic utility functions.  */

> /* Allocate a scratch buffer with the given size.  The buffer must be
>    used before the next call to allocscratch.  */

> static void *
> allocscratch (size_t size)
> {

> }

> now, on the line below the first comment, type:

> typedef struct foo

> then pause for a second, and type:

> bar;

> c-found-types will then contain "allocscratch"!.

Yes.  This is not good.  Please try out the attached patch which applies
cleanly to the release branch (and almost certainly to the master branch
too).  This should fix the problem, in that although "allocscratch" gets
entered into c-found-types, it gets removed again as soon as a type and
declarator are typed in after the typedef.

> Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu)
>  of 2022-11-29
> Package: CC Mode 5.35.2 (C/*l)
> Buffer Style: gnu
> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties category-properties 1-bit)

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).

[diff.20221208.diff (text/plain, attachment)]

This bug report was last modified 2 years and 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.