wxMac FindMenu SWIG/API problem

Hi Robin,

I've come across another one of those strange things. :wink: When compiling the core extension, I got the following error message:

路路路

------------------------------
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -g -DSWIG_TYPE_TABLE=_wxPython_table -DHAVE_CONFIG_H -DWXP_USE_THREAD=1 -UNDEBUG -D__WXDEBUG__ -D__WXMAC__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA -Iinclude -Isrc -I/opt/wx/2.6/lib/wx/include/mac-unicode-debug-2.6 -I/opt/wx/2.6/include/wx-2.6 -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3 -c src/mac/_core_wrap.cpp -o build.unicode/temp.darwin-8.0.0-Power_Macintosh-2.3/src/mac/_core_wrap.o -g -O0
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
src/mac/_core_wrap.cpp: In function `PyObject* _wrap_MenuBar_FindMenu(PyObject*, PyObject*, PyObject*)':
src/mac/_core_wrap.cpp:35456: error: passing `const wxMenuBar' as `this' argument of `int wxMenuBar::FindMenu(const wxString&)' discards qualifiers
------------------------------

Doing a little detective work, I found the problem (or possibly part of it) - _menu.i and wx/include/menu.h both have FindMenu as a const function, whereas the header in wx/include/mac/carbon/menu.h is not const. Removing const from the _menu.i file definition of FindMenu allowed it to compile, though I know that's not the correct fix. The odd part is that all of these headers and *.i files do not seem to have changed in quite some time. So I'm not sure if moving to Tiger/gcc4 caused this problem, or what. It would seem the appropriate fix is to get wx/include/mac/carbon/menu.h in sync with other ports and make it const, but does this affect backwards compatibility? Or maybe there's something simpler I'm missing here.

Thanks,

Kevin

Kevin Ollivier wrote:

Doing a little detective work, I found the problem (or possibly part of it) - _menu.i and wx/include/menu.h both have FindMenu as a const function, whereas the header in wx/include/mac/carbon/menu.h is not const. Removing const from the _menu.i file definition of FindMenu allowed it to compile, though I know that's not the correct fix.

It works for me! :wink:

The odd part is that all of these headers and *.i files do not seem to have changed in quite some time. So I'm not sure if moving to Tiger/ gcc4 caused this problem, or what.

It was a warning before.

It would seem the appropriate fix is to get wx/include/mac/carbon/menu.h in sync with other ports and make it const, but does this affect backwards compatibility?

Yes it would break binary compatibility as the const-ness is encoded , but I'm not sure that it isn't already in a worse state since the compiler is going to treat the two versions almost as if they were named differently...

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Robin,

Kevin Ollivier wrote:

Doing a little detective work, I found the problem (or possibly part of it) - _menu.i and wx/include/menu.h both have FindMenu as a const function, whereas the header in wx/include/mac/carbon/menu.h is not const. Removing const from the _menu.i file definition of FindMenu allowed it to compile, though I know that's not the correct fix.

It works for me! :wink:

Sorry, but just to be sure, are you saying you don't see the problem or you agree with the fix? :wink: BTW, if the latter, I should #ifdef it for Mac, right?

[snip]

It would seem the appropriate fix is to get wx/include/mac/carbon/menu.h in sync with other ports and make it const, but does this affect backwards compatibility?

Yes it would break binary compatibility as the const-ness is encoded , but I'm not sure that it isn't already in a worse state since the compiler is going to treat the two versions almost as if they were named differently...

Yeah, I really wish that their ADC select system would be forgiving about who select members give seeds to. I'll be willing to sign an NDA or whatever, I just want to be able to catch these issues before they end up in a release build. ;-/ It's just annoying that we couldn't tackle these issues until 2.6.0 was already released.

Thanks,

Kevin

路路路

On May 2, 2005, at 3:31 PM, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org

Kevin Ollivier wrote:

Hi Robin,

Kevin Ollivier wrote:

Doing a little detective work, I found the problem (or possibly part of it) - _menu.i and wx/include/menu.h both have FindMenu as a const function, whereas the header in wx/include/mac/carbon/ menu.h is not const. Removing const from the _menu.i file definition of FindMenu allowed it to compile, though I know that's not the correct fix.

It works for me! :wink:

Sorry, but just to be sure, are you saying you don't see the problem or you agree with the fix? :wink: BTW, if the latter, I should #ifdef it for Mac, right?

I agree with the fix (and it's already done.) The #ifdef isn't needed because the way that the code is generated the const-ness of the method doesn't matter.

路路路

On May 2, 2005, at 3:31 PM, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!