From: <no...@so...> - 2001-04-09 08:43:08
|
Bugs item #414799, was updated on 2001-04-08 21:22 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=414799&group_id=2435 Category: gcc Group: None Status: Open Priority: 5 Submitted By: TAMURA Kent (tkent) Assigned to: Nobody/Anonymous (nobody) Summary: __stdcall and typedef Initial Comment: Environment: gcc-2.95.2-3 Windows 2000 In the following case, __stdcall for TIMECALLBACK1 is ignored. callback.cpp ------------------------------------- typedef void (__stdcall TIMECALLBACK1)(int,int); typedef void __stdcall (TIMECALLBACK2)(int,int); void callFoo(TIMECALLBACK1* callback1, TIMECALLBACK2* callback2) { int i; for (i = 0; i < 1000; i++) { (*callback1)(1, 2); } for (i = 0; i < 1000; i++) { (*callback2)(1, 2); } } -------------------------------------------------- With "g++ -O2 -S callback.cpp" I got the following: ------------------------------------------ L6: addl $-8,%esp pushl $2 pushl $1 call *%esi addl $16,%esp ;****** <- Problem decl %ebx jns L6 movl $999,%ebx .p2align 4,,7 L11: addl $-8,%esp pushl $2 pushl $1 call *%edi addl $8,%esp ;****** decl %ebx jns L11 leal -24(%ebp),%esp ------------------------------------------- Calls for `callback1' is not compiled as __stdcall. It must be the same as calls for `callback2'. Workarounds are: - Use C. This problem occurs only in C++. - Move the position of __stdcall like TIMECALLBACK2. But w32api has many typedefs like TIMECALLBACK1. ---------------------------------------------------------------------- >Comment By: Danny Smith (dannysmith) Date: 2001-04-09 01:43 Message: Logged In: YES user_id=11494 This bug is fixed by the following patch: C++ parser bug with function attributes: http://gcc.gnu.org/ml/gcc-patches/2001-01/msg01751.html The patch is incorporated in cygwin gcc-2.95.3-2 source distro. Danny ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=414799&group_id=2435 |