Subject: Re: bug#60769: CC Mode 5.35.2 (C/*l); More incorrect type recognition

From: Alan Mackenzie <[email-masked]>
Date: Mon, 16 Jan 2023 18:07:51 +0000

Hello, Po.

On Fri, Jan 13, 2023 at 11:01:44 +0800, Po Lu via CC-Mode-help wrote:
> Package: cc-mode

> Here is another example of incorrect type recognition in C Mode as a
> result of a typo:

> static Lisp_Object
> frame_geometry (Lisp_Object frame, Lisp_Object attribute)
> {
>   struct frame *f = decode_live_frame (frame);
>   /**   XWindowAttributes atts; **/
>   Window rootw;
>   unsigned int ign, native_width, native_height, x_border_width = 0;
>   int x_native = 0, y_native = 0, xptr = 0, yptr = 0;
>   int left_off = 0, right_off = 0, top_off = 0, bottom_off = 0;
>   int outer_left, outer_top, outer_right, outer_bottom;
>   int native_left, native_top, native_right, native_bottom;
>   int inner_left, inner_top, inner_right, inner_bottom;
>   int internal_border_width;
>   bool menu_bar_external = false, tool_bar_external = false;
>   int menu_bar_height = 0, menu_bar_width = 0;
>   int tab_bar_height = 0, tab_bar_width = 0;
>   int tool_bar_height = 0, tool_bar_width = 0;

>   if (FRAME_INITIAL_P (f) || !FRAME_ANDROID_P (f)
>       || !FRAME_ANDROID_WINDOW (f))
>     return Qnil;

>   block_input ();
>   android_get_geometry (FRAME_ANDROID_WINDOW (f),
> 			&rootw, &x_native, &y_native,
> 			&native_width, &native_height, &x_border_width,
> 			&ign);
>   unblock_input ();
> }

> Place point after "android_get_geometry (", and accidentally type:

>   d

> (this was meant to be C-M-d.)

> Now, FRAME_ANDROID_WINDOW and android_get_geometry are stuck in
> c-found-types.

I'm afraid I can't reproduce this on either master or emacs-29.  Am I
correct in assuming that you mean insert the one single character "d"
after the "(" in that line?  Even when I additionally insert a space,
M-: (c-list-found-types) just lists "Window", which seems correct.

> Thanks.

> Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu)
>  of 2023-01-13
> 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).