Re: [Plib-devel] build break on mac os x plib with svn version and gcc > 3.3 ( patched)
Brought to you by:
sjbaker
From: Fay J. F Dr C. U. AFSEO/SK <joh...@eg...> - 2006-12-12 23:43:37
|
Ima, Thank you for pointing out the error. I will fix it in SVN. While the earlier versions of GCC didn't complain about the static linkage of the static class member function, I don't think it is good C++ practice (anybody who disagrees with me is free to correct me on this point) so I have not bothered with the GCC version checking. I have simply taken out the word "static" on line 279. John F. Fay Technical Fellow Jacobs/Sverdrup TEAS Group 850-883-1294 -----Original Message----- From: Ima Sudonim [mailto:Ima...@co...] Sent: Sunday, December 10, 2006 6:06 AM To: joh...@eg... Subject: build break on mac os x plib with svn version and gcc > 3.3 (patched) John, Hi, there is an error in the mac os x js code (jsMacOSX.cxx) that is in svn. gcc 3.3 just warns about the problem (static member function declaration) [g4:plib/src/js] ima% gcc-3.3 jsmacosx.cxx -I/include/plib jsmacosx.cxx:279: warning: cannot declare member function `static void os_specific_s::elementEnumerator(const void*, void*)' to have static linkage at least 4.0 and later treat this as an error and break the plib build on mac os x [g4:plib/src/js] ima% gcc-4.0 jsmacosx.cxx -I/include/plib jsmacosx.cxx:278: error: cannot declare member function 'static void os_specific_s::elementEnumerator(const void*, void*)' to have static linkage I have enclosed a patch to fix this problem for versions of gcc > 3.3 (I'm not sure when the behavior changed). The static in the function prototype does not cause problems even on versions of gcc > 3.3 so I left that alone. I don't know if any previous versions of mac os x relied on this static behavior so I left the 'static' keyword in for compiles with gcc versions 3.3 or earlier With these changes, I verified that the file builds without this error on mac os x (10.4.8) with gcc versions 3.3, 4.0, and 4.01 g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"plib\" - DVERSION=\"1.8.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 - DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 - DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 - DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -I. -I. -I../../src/util -g - O2 -Wall -c -o jsMacOSX.o `test -f 'jsMacOSX.cxx' || echo './'`jsMacOSX.cxx rm -f libplibjs.a ar cru libplibjs.a js.o jsLinux.o jsLinuxOld.o jsMacOS.o jsMacOSX.o jsWindows.o jsBSD.o jsNone.o ranlib libplibjs.a If this meets with your approval, could you please patch the file in svn? Thank you for your help and thank you for all your work on the plib project... Best regards Ima --------- --- jsmacosx.cxx.orig 2006-10-17 17:45:32.000000000 -0400 +++ jsMacosx.cxx 2006-12-10 06:49:57.000000000 -0500 @@ -18,7 +18,7 @@ For further information visit http://plib.sourceforge.net - $Id: jsMacOSX.cxx 1960 2004-09-21 11:45:55Z smokydiamond $ + $Id: jsMacOSX.cxx,v 1.4 2004/09/21 11:45:55 smokydiamond Exp $ */ #include "js.h" @@ -275,8 +275,13 @@ &elementEnumerator, joy); } +// compiling with gcc newer than v. 3.3 breaks build if static used here +#if ( ( __GNUC__ >= 4 ) || ( __GNUC__ == 3 ) && (__GNUC_MINOR__ > 3 ) ) +void os_specific_s::elementEnumerator( const void *element, void* vjs) +#else static void os_specific_s::elementEnumerator( const void *element, void* vjs) -{ +#endif // GNU C version test +{ if (CFGetTypeID((CFTypeRef) element) != CFDictionaryGetTypeID ()) { ulSetError(UL_WARNING, "element enumerator passed non-dictionary value"); return; --------- |