Apache OpenOffice (AOO) Bugzilla – Issue 1215
min and max macro's in solar.h over-ride std::min and std::max
Last modified: 2003-12-06 14:52:34 UTC
I have been building with STLport-0609 which is essentially STLport-4.1b8 (alpha), and I have been getting build breakages all over the place ... due to min and max macro's in solar.h Making: ../../unxirxm3.pro/obj/stream.obj g++ -c -w -nostdinc++ -I. -I. -I../inc -I../../inc -I../../unx/inc - I../../unxirxm3.pro/inc -I. -I/projects/sise/openoffice/devel/workpits/632-irix- gcc2.95.2-STL_port/workarea/solver/632/unxirxm3.pro/inc - I/projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/solver/632/unxirxm3.pro/inc/external - I/projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/solenv/unxirxm3/inc - I/projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/solenv/inc -I/projects/sise/openoffice/devel/workpits/632- irix-gcc2.95.2-STL_port/workarea/res -I/usr/local/STLport-0601//stlport - I/projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/solenv/inc/Xp31 -I/usr/local/java_1.2.2/usr/java//include - I/usr/local/java_1.2.2/usr/java//include/irix - I/usr/local/java_1.2.2/usr/java//include/native_threads/include -I. - I../../res -I. -I/projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/solenv/unxlngi3/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include - I/projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/solenv/unxlngi3/usr/include -O2 -fno-for-scope - fpermissive -fno-exceptions -DIRIX -DUNX -DVCL -DGCC -DC295 -DMIPS - DUSE_PSPRINT -DTF_UCB -DENABLEUNICODE -DTF_FILTER -DCVER=C295 -D_USE_NAMESPACE - D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1 -DSTLPORT_VERSION=400 - D__DMAKE -DUNIX -DSUPD=632 -DBUILD=6483 -DSOLAR_PLUGIN -DVCL -DSO3 -DPRODUCT - DNDEBUG -DPRODUCT_FULL -DOPTIMIZE -DEXCEPTIONS_OFF -DGUI -DSOLAR_JAVA - DSRC632 -DTF_ONE51 -DMULTITHREAD - o ../../unxirxm3.pro/obj/stream.o /projects/sise/openoffice/devel/workpits/632- irix-gcc2.95.2-STL_port/workarea/tools/source/stream/stream.cxx /projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/tools/source/stream/stream.cxx: In method `ErrCode SvAsyncLockBytes::ReadAt(long unsigned int, void *, long unsigned int, ULONG *) const': /projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/tools/source/stream/stream.cxx:358: parse error before `(' /projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/tools/source/stream/stream.cxx: In method `ErrCode SvAsyncLockBytes::WriteAt(long unsigned int, const void *, long unsigned int, ULONG *)': /projects/sise/openoffice/devel/workpits/632-irix-gcc2.95.2- STL_port/workarea/tools/source/stream/stream.cxx:375: parse error before `(' dmake: Error code 1, while making '../../unxirxm3.pro/obj/stream.obj' ---* TG_SLO.MK *--- I would be interested in why I have this error ... I can only assume it is the version of STLport I am using. I am currently attempting to wrap the macro's in #ifndef __cplusplus. This could potentially break any c++ which does not use std:: .
Created attachment 374 [details] tools/inc/solar.h : Patch to remove min/max macro's from c++
Created attachment 381 [details] vcl/unx/source/gdi/xfont.cxx : Patch to use std::min
vcl is the first module which breaks on this change to solar.h vcl is still broken and attachment 381 [details] should not be pushed in. Damn why cant they be simple one line fixes.
Created attachment 382 [details] vcl/unx/source/gdi/xfont.cxx : Patch to build on IRIX, needs further testing
I am not even going to pretend that 382 is correct, however it does build and pass checkdll. Further changes will be needed on other platforms which I can not build. vcl/mac/source/app/NoSharMain.cxx: applZone->moreMast = (short) min(numMasterPointersDesired, SHRT_MAX); vcl/win/source/app/salinfo.cxx: + max (pSection->SizeOfRawData, pSection->Misc.VirtualSize); There is also a good chance that there are other uses of the min/max macro's within c++ code which have not come within reach of my compiler.
Sander .. I have just completed a build with this patch ... and there were no other affected files (on IRIX).
Heiner, can please take care of these ?
Accepted
The only way to really fix this problem is to remove the min()/max() macros from solar.h and use the std::min()/std::max() templates everywhere.
Wouldnt this result in min()/max() not being available in files which are not c++?
fixed in SRC641 g
closed