We still build our older toolkit with CW on PPC macs and recently
upgraded to Xcode 2.4. When rebuilding the CW libraries and
pre-compiled headers we got an error:
CodeWarrior gives a "type cannot be made with a global register
variable" error about the __asm("_scalb$UNIX2003" ) construct on line
647 of math.h in Xcode 2.4. I show the relevant lines of math.h from
2.3 and 2.4 below. Although the BuildLibraries.mcp projects built, when
I tried to build the
Build.MacOSX.mcp->BuildMacOSXSup****t.mcp->MacHeadersMach-O.mcp
precompiled headers, it gave the math.h error about 18 times. This did
not stop the rest of the build, but that may be because I already had
libraries.
We are running MacOS 10.4.7 on a G5 iMac.
Anyone seen this? Have a fix? It would be nice if Apple kept stuff out
of the standard headers that broke other compilers (obsolete or not).
math.h 2.3
#if __DARWIN_UNIX03
extern double scalb ( double, double ) __DARWIN_ALIAS(scalb); /*
UNIX03 legacy signature */
#else
extern double scalb ( double, int ); /* Mac OS X legacy signature */
#endif /* __DARWIN_UNIX03 */
-----
math.h 2.3
/*
* Scalb Travellers' advisory:
* ---------------------------
*
* Reduction of Information advisory -- This advisory may constitute
"too much information". Readers who are easily panicked
* or confused may be needlessly
panicked or confused by this advisory.
*
* We are in the process of retiring the legacy scalb. IEEE-754 did not
specify what the argument types should be
* for scalb. We guessed scalb(double, int) -- ints are faster to use
here -- but our guess and what later standards
* standard eventually settled on did not agree. To be compliant with
these standards, our scalb needs to be scalb(double, double).
* Unfortunately, we have a commitment to be binary compatible with old
software compiled against scalb(double, int)
* for older operating systems, so the old symbol _scalb must live on in
perpetuity in the __ppc__ binary interface to service
* this need. To deal with this problem, we have introduced a new binary
symbol _scalb$UNIX2003 and did some magic below
* so that when you now compile against scalb() on a __ppc__
application, you get linked to _scalb$UNIX2003 instead. Thus,
* this constitutes a source level *** API CHANGE *** from scalb(
double, int ) to scalb( double, double) on __ppc__ only
* that your source will need to contend with if you compile with this
header. On __ppc__, all ints are exactly representable
* as doubles so from an arithmetic standpoint, this should cause no
changes arithmetically from parameters of int type, but there
* remains the danger of triggering various compiler warnings that might
balloon to more serious problems under -Werror.
*
* On __ppc64__, __i386__ and future archs, scalb has always been scalb(
double, double) and will continue to be so. Thus, this change
* will make scalb on all platforms behave identically, with the same
parameter types. The change will also eliminate GCC warnings about
* the math.h scalb declaration not matching the gcc4 builtin version.
*
* The intent is that you will "never know" that a change occurred, and
your code should "just do the right thing" without modification.
* However, if you would like to sidestep any problems associated with
this move, it is suggested that you use the C99 scalbn or scalbln
* or single/long double variants as appropriate instead. Their behavior
and type is rigorously defined. There should be no hidden arithmetic
* "gotchas" if you simply replace all legacy calls to scalb with
scalbn, since they essentially do the same thing. If you
* decide to take this step, you should exercise due diligence to make
sure that scalbn is present in the oldest version of
* MacOS X that you sup****t. Otherwise, your application may fail to
load on older systems. C99 sup****t was introduced in MacOS X.3.9.
*
* Use of the symbol _scalb$UNIX2003 should not in itself be construed
to mean that scalb$UNIX2003 necessarily is UNIX 2003 compliant.
* UNIX is a registered trademark of The Open Group.
*/
/* maps to _scalb$UNIX2003 on __ppc__ and _scalb elsewhere */
#if defined( __ppc__ )
extern double scalb ( double, double ) __asm("_scalb$UNIX2003" );
#else
extern double scalb ( double, double );
#endif


|