From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs 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 Organization: muc.de e.V. Message-ID: <20160423114830.99485.qmail@mail.muc.de> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1461412159 4264 80.91.229.3 (23 Apr 2016 11:49:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Apr 2016 11:49:19 +0000 (UTC) Cc: 23313@debbugs.gnu.org To: Mohammed Sadik Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 23 13:49:10 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1atw3i-0001ia-2W for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Apr 2016 13:49:10 +0200 Original-Received: from localhost ([::1]:51857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atw3h-0008Se-Gr for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Apr 2016 07:49:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atw3e-0008Qh-54 for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2016 07:49:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1atw3a-0005Dv-SB for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2016 07:49:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atw3a-0005Dn-Pk; Sat, 23 Apr 2016 07:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1atw3a-0001Fr-IS; Sat, 23 Apr 2016 07:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 23 Apr 2016 11:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23313 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 23313-submit@debbugs.gnu.org id=B23313.14614121144782 (code B ref 23313); Sat, 23 Apr 2016 11:49:02 +0000 Original-Received: (at 23313) by debbugs.gnu.org; 23 Apr 2016 11:48:34 +0000 Original-Received: from localhost ([127.0.0.1]:43641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1atw37-0001F4-P6 for submit@debbugs.gnu.org; Sat, 23 Apr 2016 07:48:33 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:14825) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1atw35-0001Ev-TX for 23313@debbugs.gnu.org; Sat, 23 Apr 2016 07:48:32 -0400 Original-Received: (qmail 99486 invoked by uid 3782); 23 Apr 2016 11:48:30 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE (amd64)) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:116698 Archived-At: Hello, Mohammed. In article 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).