bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23313: 25.0.92; CC Mode not recognizing function declarations that r


From: Alan Mackenzie
Subject: bug#23313: 25.0.92; CC Mode not recognizing function declarations that returns pointer to custom type
Date: 23 Apr 2016 11:48:30 -0000
User-agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE (amd64))

Hello, Mohammed.

In article <mailman.657.1461074349.7477.bug-gnu-emacs@gnu.org> you wrote:
> c-mode doesn't recognize (or at least colorize as per current rules)
> function declarations that returns a pointer (or pointer to pointer) to
> custom data types:

> Eg., If my c file contains:

>      GtkWidget *
>      my_window_new (GtkApplication *app);

> Its not recognized as a function declaration, while this works:

>      GtkWidget
>      my_window_new (GtkApplication *app);

Yes.

I think the reason for this is that the first expression is ambiguous.
It could be the function declaration you want it to be, or it could be
the arithmetic expression "GtkWidget times the result of calling
my_window_new with argument GtkApplication times app".  We need to be
careful that expressions like that don't get fontified as declarations by
mistake.

My current idea for resolving this ambiguity is to examine the token
before GtkWidget; if this is a ";" or a "}" or a "{", then we have a
declaration, if it's something else, we have an arithmetic expression.
Or something like that.

Give me a little time, and I'll see what I can come up with.

> Package: CC Mode 5.33

> In GNU Emacs 25.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
>  of 2016-04-13 built on fedora.localdomain
> Windowing system distributor 'Fedora Project', version 11.0.11800000
> Configured features:
> XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS
> LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

-- 
Alan Mackenzie (Nuremberg, Germany).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]