public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14333] New: __stdcall in function declaration in structure ignored?
@ 2004-02-28 14:41 buytenh at gnu dot org
  2004-02-28 15:30 ` [Bug c/14333] " schwab at suse dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: buytenh at gnu dot org @ 2004-02-28 14:41 UTC (permalink / raw)
  To: gcc-bugs

This code fragment gives 'warning: initialization from incompatible pointer type':

static void __stdcall example_func(void)
{
}

struct {
        void __stdcall (*example_method)(void);
} y = {
        .example_method = example_func,
};

Removing the __stdcall from the struct declaration does not make the warning
go away, whereas removing the __stdcall from the function declaration does.
Which makes me believe that the __stdcall in the struct declaration is being
ignored.

Am I doing something wrong?

-- 
           Summary: __stdcall in function declaration in structure ignored?
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: buytenh at gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-mingw32
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/14333] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
@ 2004-02-28 15:30 ` schwab at suse dot de
  2004-02-28 16:22 ` buytenh at gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: schwab at suse dot de @ 2004-02-28 15:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schwab at suse dot de  2004-02-28 15:30 -------
Move __stdcall to the correct place. 
 
struct { 
        void (*__stdcall example_method)(void); 
} y = { 
        .example_method = example_func, 
}; 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/14333] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
  2004-02-28 15:30 ` [Bug c/14333] " schwab at suse dot de
@ 2004-02-28 16:22 ` buytenh at gnu dot org
  2004-02-28 16:25 ` schwab at suse dot de
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: buytenh at gnu dot org @ 2004-02-28 16:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From buytenh at gnu dot org  2004-02-28 16:22 -------
Subject: Re:  __stdcall in function declaration in structure ignored?

Sorry, that is a no go.

% cat x.c
static void __stdcall example_func(void)
{
}

struct {
        void (*__stdcall example_method)(void);
} y = {
        .example_method = example_func,
};

int main()
{
        return 0;
}
% i386-mingw32-gcc -o x x.c
x.c:8: warning: initialization from incompatible pointer type





On Sat, Feb 28, 2004 at 03:30:57PM -0000, schwab at suse dot de wrote:

> 
> ------- Additional Comments From schwab at suse dot de  2004-02-28 15:30 -------
> Move __stdcall to the correct place. 
>  
> struct { 
>         void (*__stdcall example_method)(void); 
> } y = { 
>         .example_method = example_func, 
> }; 
> 
> -- 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |RESOLVED
>          Resolution|                            |INVALID
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/14333] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
  2004-02-28 15:30 ` [Bug c/14333] " schwab at suse dot de
  2004-02-28 16:22 ` buytenh at gnu dot org
@ 2004-02-28 16:25 ` schwab at suse dot de
  2004-02-28 20:40 ` [Bug target/14333] [3.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: schwab at suse dot de @ 2004-02-28 16:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schwab at suse dot de  2004-02-28 16:25 -------
Sorry. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/14333] [3.3 Regression] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
                   ` (2 preceding siblings ...)
  2004-02-28 16:25 ` schwab at suse dot de
@ 2004-02-28 20:40 ` pinskia at gcc dot gnu dot org
  2004-02-28 21:16 ` dannysmith at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-28 20:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-28 20:40 -------
This is fixed for 3.4.0 but it is a regression for 3.3.1 from 3.0.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |target
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic, rejects-valid
      Known to fail|                            |3.3.1
      Known to work|                            |3.5.0 3.4.0 3.0.4
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-28 20:40:58
               date|                            |
            Summary|__stdcall in function       |[3.3 Regression] __stdcall
                   |declaration in structure    |in function declaration in
                   |ignored?                    |structure ignored?
   Target Milestone|---                         |3.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/14333] [3.3 Regression] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
                   ` (3 preceding siblings ...)
  2004-02-28 20:40 ` [Bug target/14333] [3.3 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-28 21:16 ` dannysmith at gcc dot gnu dot org
  2004-02-28 21:24 ` buytenh at gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dannysmith at gcc dot gnu dot org @ 2004-02-28 21:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dannysmith at gcc dot gnu dot org  2004-02-28 21:16 -------
This is the usual syntax for stdcall callbacks (refer to windows32 api headers, 
eg ole.h).  It works in 3.3 branch.  I didn't think that the syntax you used in 
your original example was actually valid.

static void __stdcall example_func(void)
{
}

struct {
        void (__stdcall * example_method)(void);
} y = {
        .example_method = example_func,
};


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/14333] [3.3 Regression] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
                   ` (4 preceding siblings ...)
  2004-02-28 21:16 ` dannysmith at gcc dot gnu dot org
@ 2004-02-28 21:24 ` buytenh at gnu dot org
  2004-02-28 21:30 ` buytenh at gnu dot org
  2004-04-18 19:36 ` gdr at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: buytenh at gnu dot org @ 2004-02-28 21:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From buytenh at gnu dot org  2004-02-28 21:24 -------
Subject: Re:  [3.3 Regression] __stdcall in function declaration in structure ignored?

Gah, Danny is right.

1. void __stdcall (*example_method)(void);
2. void (__stdcall * example_method)(void);
3. void (* __stdcall example_method)(void);

Indeed, (2) does the right thing, while in (1) and (3) the __stdcall seems
to be just ignored.

If (1) and (3) are wrong, can we make them throw a warning for the unsuspecting
user?  Or does (1) and (3)'s way of using __stdcall specify an even subtly
different meaning?  Maybe it's just better altogether to make (1) and (3) do
the same thing as (2)?




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/14333] [3.3 Regression] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
                   ` (5 preceding siblings ...)
  2004-02-28 21:24 ` buytenh at gnu dot org
@ 2004-02-28 21:30 ` buytenh at gnu dot org
  2004-04-18 19:36 ` gdr at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: buytenh at gnu dot org @ 2004-02-28 21:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From buytenh at gnu dot org  2004-02-28 21:30 -------
Subject: Re:  [3.3 Regression] __stdcall in function declaration in structure ignored?

Another data point.

When used in a struct initializer, only (2) seems to honor the __stdcall.
BUT, when used outside of a struct initializer all possible ways of placing
the __stdcall seem to be honored.  This works just fine:

void __stdcall (*example_method)(void) = example_func;




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/14333] [3.3 Regression] __stdcall in function declaration in structure ignored?
  2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
                   ` (6 preceding siblings ...)
  2004-02-28 21:30 ` buytenh at gnu dot org
@ 2004-04-18 19:36 ` gdr at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-04-18 19:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-04-18 18:52 -------
(In reply to comment #6)
> Subject: Re:  [3.3 Regression] __stdcall in function declaration in structure
ignored?
> 
> Gah, Danny is right.
[...]
> 
> If (1) and (3) are wrong, can we make them throw a warning for the unsuspecting
> user?

I don't think I want to play with the parser at this point.
Won't be addressed for 3.3.x.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|3.3.4                       |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14333


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-04-18 18:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-28 14:41 [Bug c/14333] New: __stdcall in function declaration in structure ignored? buytenh at gnu dot org
2004-02-28 15:30 ` [Bug c/14333] " schwab at suse dot de
2004-02-28 16:22 ` buytenh at gnu dot org
2004-02-28 16:25 ` schwab at suse dot de
2004-02-28 20:40 ` [Bug target/14333] [3.3 Regression] " pinskia at gcc dot gnu dot org
2004-02-28 21:16 ` dannysmith at gcc dot gnu dot org
2004-02-28 21:24 ` buytenh at gnu dot org
2004-02-28 21:30 ` buytenh at gnu dot org
2004-04-18 19:36 ` gdr at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).