-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Because I'm having some annoying compiler warnings when compiling the subversion classical VM squeak 4.19.2, I'm checking the FloatMathPlugin.
First of all the problem is the following, about 70 errors like this:
"./platforms/Cross/plugins/FloatMathPlugin/fdlibm/fdlibm.h", line 19: warning: m acro redefined: __LITTLE_ENDIAN
The Makefile for building the FloatMathPlugin sets
./i86/FloatMathPlugin/CMakeFiles/FloatMathPlugin.dir/flags.make:C_DEFINES = -DNO _ISNAN=1 -DSQUEAK_BUILTIN_PLUGIN=1 -D__LITTLE_ENDIAN=1
The flag -D__LITTLE_ENDIAN=1 comes from cmake 's config.cmake:
In platforms/unix/plugins/FloatMathPlugin/config.cmake you can see
PLUGIN_DEFINITIONS (-D__LITTLE_ENDIAN=1)
Now at the same time the fdlibm.h header file redefines the __LITTLE_ENDIAN:
#if defined(i386) || defined(i486) || \ defined(intel) || defined(x86) || defined(i86pc) || \ defined(__alpha) || defined(__osf__) #define __LITTLE_ENDIAN #endif
So this causes lots of harmless but annoying,
"./platforms/Cross/plugins/FloatMathPlugin/fdlibm/fdlibm.h", line 19: warning: m acro redefined: __LITTLE_ENDIAN
I'd like to get rid of those warnings by fixing the fdlibm.h.
If I compare platforms/Cross/plugins/FloatMathPlugin/fdlibm/fdlibm.h in the subversion sources (for Squeak 4.19.2), and in the opensmalltalk git sources (for Squeak Cog 5.0 ), then I notice major differences.
In both cases the head of the fdlibm.h file is the same:
/* @(#)fdlibm.h 1.5 04/04/22 */ /* * ==================================================== * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */
However if I "diff" the fdlibm.h from OpenSmalltalk and the one that is in Subversion, they seem very different.
For example the OpenSmalltalk fdlibh.h has
#ifdef __cplusplus
while that is not present in the subversion 4.19.2 sources for the fdlibm.h.
As an experiment I copied the one from OpenSmalltalk to the VM 4.19.2:
bash-4.4$ cp $HOME/src/opensmalltalk/platforms/Cross/third-party/fdlibm/fdlibm.h $HOME/src/squeak4vm/platforms/Cross/plugins/FloatMathPlugin/fdlibm/fdlibm.h
If you run then
svn diff
you gets lots of differences between the fdlibm.h from OpenSmalltalk, and the one that is in subversion.
However the OpenSmalltalk fdlibm.h is NOT compiling in the classical VM 4.19.2.
I can fix the compiler warnings by the following small patch:
bash-4.4$ svn diff fdlibm.h Index: fdlibm.h =================================================================== - --- fdlibm.h (revision 3790) +++ fdlibm.h (working copy) @@ -16,8 +16,10 @@ #if defined(i386) || defined(i486) || \ defined(intel) || defined(x86) || defined(i86pc) || \ defined(__alpha) || defined(__osf__) +#ifndef __LITTLE_ENDIAN #define __LITTLE_ENDIAN #endif +#endif
With the above patch I get a clean build for the FloatMathPlugin.
It results in a clean build for both 64bit and 32bit.
Which is important as the CMAKE comment indicates the cmake flag is set, precisely for the 64bit case (the 64bit case was not dealt with by the SunOS 2004 header file).
So what happened I think is that the cmake settings was done for 64bit, and it started to cause a lot of redefined macro warnings in the 32bit case.
Would it please be possible to commit the above small patch to the subversion sources ?
This would suppress the compiler warnings.
Thanks ! David Stes