http://bugs.winehq.org/show_bug.cgi?id=27367
Summary: widl: gcc warns about pointer mismatch when calling pfnFree Product: Wine Version: 1.3.21 Platform: x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: tools AssignedTo: wine-bugs@winehq.org ReportedBy: cerebro.alexiel@gmail.com
Created an attachment (id=34992) --> (http://bugs.winehq.org/attachment.cgi?id=34992) Patch that fixes the warning by adding a cast to void * when calling pfnFree
When compiling latest wine, I have the following warning :
../../tools/widl/widl -I../../../git-wine/dlls/actxprxy -I. -I../../../git-wine/include -I../../include -D__WINESRC__ -DWINE_REGISTER_DLL -DPROXY_DELEGATION -p -o actxprxy_shobjidl_p.c ../../../git-wine/dlls/actxprxy/actxprxy_shobjidl.idl ../../tools/widl/widl -I../../../git-wine/dlls/actxprxy -I. -I../../../git-wine/include -I../../include -D__WINESRC__ -DWINE_REGISTER_DLL -DPROXY_DELEGATION -h -o actxprxy_shobjidl.h ../../../git-wine/dlls/actxprxy/actxprxy_shobjidl.idl gcc -c -I../../../git-wine/dlls/actxprxy -I. -I../../../git-wine/include -I../../include -D__WINESRC__ -DWINE_REGISTER_DLL -DPROXY_DELEGATION -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith -Wlogical-op -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -o actxprxy_shobjidl_p.o actxprxy_shobjidl_p.c actxprxy_shobjidl_p.c: In function ‘__finally_IFileDialog_SetFileTypes_Stub’: actxprxy_shobjidl_p.c:94496:9: warning: passing argument 1 of ‘__frame->_StubMsg.pfnFree’ discards qualifiers from pointer target type actxprxy_shobjidl_p.c:94496:9: note: expected ‘void *’ but argument is of type ‘const struct COMDLG_FILTERSPEC *’
The actxprxy_shobjidl_p.c file is generated by widl from include/shobjidl.idl. I found 3 references for pfnFree in tools/widl/typegen.c so I added a (void *) cast 3 times with more or less spaces.
It appears the relevant pfnFree is at typegen.c:3778.
I'm attaching a patch that made the warning disappear. Can someone tell me if this is the right approach ?
Ideally, wine would compile without any warning whatever your compiler or architecture is.
http://bugs.winehq.org/show_bug.cgi?id=27367
--- Comment #1 from Alexandre Julliard julliard@winehq.org 2011-06-02 06:45:24 CDT --- Probably a cleaner way would be to not declare it const in the first place.
http://bugs.winehq.org/show_bug.cgi?id=27367
--- Comment #2 from Alex cerebro.alexiel@gmail.com 2011-06-04 07:43:56 CDT --- You're right but in this case, wine SetFileTypes would not match the Windows prototype anymore.
See http://msdn.microsoft.com/en-us/library/bb775980%28v=vs.85%29.aspx
Your proposed solution doesn't fix the problem but just this particular case.
I know casts are evil (because they often hide a real issue) but what about this one ?
We could also simply ignore this warning as it has no real impact and (among the 45 warnings I have), some are more important (e.g. call_server_func not implemented for your architecture)
http://bugs.winehq.org/show_bug.cgi?id=27367
--- Comment #3 from Alexandre Julliard julliard@winehq.org 2011-06-04 08:45:43 CDT --- I'm of course not suggesting to change the idl source, we can't do that. What I'm saying is that widl shouldn't output the const in the stub, since it's not const there because we are unmarshalling into it.
http://bugs.winehq.org/show_bug.cgi?id=27367
--- Comment #4 from Alex cerebro.alexiel@gmail.com 2011-06-04 09:05:27 CDT --- It makes more sense this way.
As you began to clean/improve widl recently, feel free to fix it.
I'm definitely not an expert with widl but I know how to report clear and useful bugs.
Thanks for the energy you invest in wine : after all, it's the weekend and you (and probably I) have a life.
http://bugs.winehq.org/show_bug.cgi?id=27367
Alex cerebro.alexiel@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #5 from Alex cerebro.alexiel@gmail.com 2011-12-16 08:21:06 CST --- I compiled the latest wine from git and the warning doesn't appear any more.
I also tried to do a git bisect to find the commit which fixed it but git disallow bisecting with a bad commit older than the good one.
So I'm closing this bug as fixed.
http://bugs.winehq.org/show_bug.cgi?id=27367
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org 2011-12-16 13:30:41 CST --- Closing bugs fixed in 1.3.35.