[Top][All Lists]

[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: Mohammed Sadik
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

On 4/23/16, Alan Mackenzie <address@hidden> 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.

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 ';'

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).

    Mohammed Sadik

reply via email to

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