all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mohammed Sadik <sadiq@sadiqpk.org>
To: Alan Mackenzie <acm@muc.de>
Cc: 23313@debbugs.gnu.org
Subject: bug#23313: 25.0.92; CC Mode not recognizing function declarations that returns pointer to custom type
Date: Sat, 23 Apr 2016 22:17:13 +0530	[thread overview]
Message-ID: <CANHUxH13Z2Qif70VBiyR7WS5AzkRk+BmKpPoZiU7AJ9_FdkkFA@mail.gmail.com> (raw)
In-Reply-To: <20160423145831.GA4624@acm.fritz.box>

On 4/23/16, Alan Mackenzie <acm@muc.de> wrote:

> OK, I've written a trial patch along these lines.  Could you try it out,
> please, and let me know whether it works OK, or still has some faults.
>
 <snip>

The patch was not applying to my Emacs 25.0.93 source. patched by hand.
 And I tried your patch. It was working right, with some minor glitches:

*  The right face is applied only after the statement is made complete
with a ';'

GtkWidget
my_app_window (|)

The above code is interpreted as a function (without ';') but the one
below doesn't:

GtkWidget *
my_app_window (|)

There might be issues guessing the right way. That is, if the * is for
representing a
pointer or mathematical multiplication, but the following is also not
interpreted right
(when without ';'):

GtkWidget **
my_app_window (|)

As ** is clearly a pointer to pointer,  cc-mode shall be able to guess
very early.

I'm not an expert, though the following interpretation might be good:
1. GtkWidget |
   'GtkWidget' may be an identifier, data type, etc.

2. GtkWidget *|
   'GtkWidget' _may_ be a data type (as '*' _may_ not be present to represent
   multiplication as its is not allowed as lvalue).

3. GtkWidget **|
   'GtkWidget' is surely a data type. (not implemented now in c-mode)

4. GtkWidget * my_app_window|
   (2) and my_app_window may be an identifier.

5. GtkWidget * my_app_window (|
   'GtkWidget' may be a data type and 'my_app_window' may be a function.

6.  GtkWidget * my_app_window (int|
    This is not a function call, as 'int' is a data type. So probably
    a function definition/declaration).

Regards
    Mohammed Sadik





  reply	other threads:[~2016-04-23 16:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 13:57 bug#23313: 25.0.92; CC Mode not recognizing function declarations that returns pointer to custom type Mohammed Sadik
     [not found] ` <mailman.657.1461074349.7477.bug-gnu-emacs@gnu.org>
2016-04-23 11:48   ` Alan Mackenzie
2016-04-23 14:58     ` Alan Mackenzie
2016-04-23 16:47       ` Mohammed Sadik [this message]
2016-04-25 11:14         ` Alan Mackenzie
2016-04-25 11:40           ` Mohammed Sadik
2016-04-25 12:30             ` Alan Mackenzie
2016-04-25 13:02               ` Mohammed Sadik
2016-04-25 15:32   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANHUxH13Z2Qif70VBiyR7WS5AzkRk+BmKpPoZiU7AJ9_FdkkFA@mail.gmail.com \
    --to=sadiq@sadiqpk.org \
    --cc=23313@debbugs.gnu.org \
    --cc=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.