Issue 48845 - build broken in psprint because isnan defined twice in MacOSX10.4
Summary: build broken in psprint because isnan defined twice in MacOSX10.4
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: MacOSX (show other issues)
Version: current
Hardware: Mac Mac OS X, all
: P2 Trivial (vote)
Target Milestone: OOo 2.0
Assignee: eric.bachard
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-07 08:31 UTC by eric.bachard
Modified: 2005-07-21 22:34 UTC (History)
5 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
a patch for isnan macro in Mac OS 10.4 (626 bytes, patch)
2005-05-07 08:34 UTC, eric.bachard
no flags Details | Diff
correct patch for non use of isnan with Tiger (513 bytes, patch)
2005-05-10 21:25 UTC, eric.bachard
no flags Details | Diff
other possibility, using rtl/math.hxx (990 bytes, patch)
2005-05-11 12:13 UTC, eric.bachard
no flags Details | Diff
correct patch with full path in the filename (to be applied on m101 exactly) (943 bytes, patch)
2005-05-11 13:58 UTC, eric.bachard
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description eric.bachard 2005-05-07 08:31:32 UTC
Concerns Mac OSX 10.4 + *gcc-3.3*  

Break in psprint because of isnan macro. 

The log :

Making: ../../unxmacxp.pro/slo/strhelper.obj
ccache g++ -fsigned-char -fmessage-length=0 -malign-natural -c -I.  -I. -I../inc
-I../../inc -I../../unx/inc -I../../unxmacxp.pro/inc -I.
-I/Volumes/sauvegarde/OpenOffice.org680/solver/680/unxmacxp.pro/inc/stl
-I/Volumes/sauvegarde/OpenOffice.org680/solver/680/unxmacxp.pro/inc/external
-I/Volumes/sauvegarde/OpenOffice.org680/solver/680/unxmacxp.pro/inc
-I/Volumes/sauvegarde/OpenOffice.org680/solenv/unxmacxp/inc
-I/Volumes/sauvegarde/OpenOffice.org680/solenv/inc
-I/Volumes/sauvegarde/OpenOffice.org680/res
-I/Volumes/sauvegarde/OpenOffice.org680/solver/680/unxmacxp.pro/inc/stl
-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
-I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/X11R6/include
-I/usr/X11R6/include/freetype2     -I. -I../../res -I. -O2 -fno-strict-aliasing
  -pipe -malign-natural -fsigned-char -Wno-long-double -Wno-ctor-dtor-privacy
-fexceptions -fno-enforce-eh-specs   -fPIC -fno-common -DMACOSX -DUNX -DVCL
-DGCC -DC300 -DPOWERPC -DGXX_INCLUDE_PATH=/usr/include/gcc/darwin/3.3/c++
-DCVER=C300 -D_USE_NAMESPACE -DGLIBC=2 -D_PTHREADS -D_REENTRANT
-DNO_PTHREAD_PRIORITY -DPOWERPC -DPPC -DSTLPORT_VERSION=400 -D_USE_NAMESPACE=1
-DX_LOCALE -DNO_AUDIO -D__DMAKE -DUNIX -DCPPU_ENV=gcc3 -DSUPD=680 -DPRODUCT
-DNDEBUG -DPRODUCT_FULL -DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DEXCEPTIONS_ON -DCUI
-DSOLAR_JAVA -DSRC680  -DBUILD_OS_APPLEOSX -DBUILD_OS_MAJOR=10
-DBUILD_OS_MINOR=4 -DBUILD_OS_REV=0 -DSHAREDLIB -D_DLL_  -DMULTITHREAD  -o
../../unxmacxp.pro/slo/strhelper.o
/Volumes/sauvegarde/OpenOffice.org680/psprint/source/helper/strhelper.cxx
/Volumes/sauvegarde/OpenOffice.org680/psprint/source/helper/strhelper.cxx: In
function `int psp::getValueOfDouble(char*, double, int)':
/Volumes/sauvegarde/OpenOffice.org680/psprint/source/helper/strhelper.cxx:663:
error: `__isnan' undeclared (first use this function)
/Volumes/sauvegarde/OpenOffice.org680/psprint/source/helper/strhelper.cxx:663:
error: (Each undeclared identifier is reported only once for each function it
appears in.)
dmake:  Error code 1, while making '../../unxmacxp.pro/slo/strhelper.obj'
'---* tg_merge.mk *---'

ERROR: Error 65280 occurred while making
/Volumes/sauvegarde/OpenOffice.org680/psprint/source/helper

Looking more carefully at the code, I have seen that __isnan is, *in 10.4*
already defined in math.h, precisely in /usr/include/architecture/ppc/math.h.
Because the definition differs from the one in strhelper.cxx, this causes a
mismatch, and breaks the build.

In 10.3, this problem does not occur, I propose then to continue to use this
macro in Mac OS X <10.4, and simply skip it in Mac OS 10.4.

A tested and working patch is coming

-- 
eric bachard
Comment 1 eric.bachard 2005-05-07 08:34:27 UTC
Created attachment 25869 [details]
a patch for isnan macro in Mac OS 10.4
Comment 2 eric.bachard 2005-05-07 08:38:29 UTC
Issue started
Comment 3 eric.bachard 2005-05-07 08:40:00 UTC
This issue is approximatively the same as :
<http://www.openoffice.org/issues/show_bug.cgi?id=27753>

Comment 4 florian 2005-05-08 12:59:05 UTC
Patch looks fine for me.
Comment 5 pavel 2005-05-10 19:17:44 UTC
The patch is plain wrong.

This e.g. about FreeBSD...
Comment 6 eric.bachard 2005-05-10 20:30:06 UTC
ericb -> pjanik

I have carefully traced the build (build v and changing gcc options) and found
this macro was the origin of all Mac OSX problems. Changes are only for Mac OSX.

Can you please say what is wrong ?  This can be true, but please say us more.

And about FreeBSD, I don't know, sorry.
Comment 7 eric.bachard 2005-05-10 20:42:31 UTC
ericb -> pjanik

Yes, you're right, this patch only works on Mac OSX10.4, and breaks all other
OS. Sorry
I'll modify this asap for something like :

#if defined(MACOSX) && (BUILD_OS_MAJOR==10) && (BUILD_OS_MINOR<4)
#define      isnan( x )         ( ( sizeof ( x ) == sizeof(double) ) ?    \
                               __isnand ( x ) :                            \
                                 ( sizeof ( x ) == sizeof( float) ) ?      \
#else
// do nothing for all other OS, Tiger included
...

Thank you, Pavel


Comment 8 eric.bachard 2005-05-10 21:25:53 UTC
Created attachment 25995 [details]
correct patch for non use of isnan with Tiger
Comment 9 eric.bachard 2005-05-10 21:27:59 UTC
ericb -> maveric

Eric, can you please try to rebuild psprint on 10.3 with this new patch ?
Build is ok for me with 10.4 

Comment 10 eric.bachard 2005-05-10 21:28:34 UTC
fixed in macosx07
Comment 11 ooo 2005-05-10 21:32:58 UTC
Use ::rtl::math::isNan() instead, available from rtl/math.hxx
Comment 12 eric_openoffice 2005-05-11 12:09:33 UTC
maveric->ericb
er's suggested patch works for Mac OS X 10.3.9. Module psprint compiles. 
Comment 13 eric.bachard 2005-05-11 12:11:25 UTC
Other possibility I have tested, following erAck's suggestion to use rtl/math.hxx 

-> see new patch
Comment 14 eric.bachard 2005-05-11 12:13:21 UTC
Created attachment 26013 [details]
other possibility, using rtl/math.hxx
Comment 15 pavel 2005-05-11 12:15:14 UTC
ericb" patch looks perfect!

I like patches removing more code than adding :-)
Comment 16 eric.bachard 2005-05-11 12:22:07 UTC
If this patch is choosen, it has to be tested on every platform/os, not only MacOSX




Comment 17 eric.bachard 2005-05-11 12:42:30 UTC
fixed in macosx07

Build is fine on Mac OSX10.4

Thank's to complete the list...
Comment 18 Joost Andrae 2005-05-11 13:45:18 UTC
JA->PL: please take a look at this patch. Eric Bachard mentioned in porting.dev
it could probably break psprint on other platforms. It's in cws macosx07. Added
you to CC list.
Comment 19 eric.bachard 2005-05-11 13:58:26 UTC
Created attachment 26024 [details]
correct patch with full path in the filename (to be applied on m101 exactly)
Comment 20 philipp.lohmann 2005-05-11 15:53:14 UTC
patch looks good to me

isnan is  for completeness only anyway, should a NaN occur here it is an error
anyway since getValueOfDouble is used in psprint only; NaN is not a value that
should occur within PostScript code ...
Comment 21 pavel 2005-05-11 17:10:30 UTC
ericb: patch works on GNU/Linux with gcc 3.4.1 as well -> VERIFIED.
Comment 22 eric.bachard 2005-05-16 07:43:47 UTC
Set target for 2.0
Comment 23 eric.bachard 2005-05-16 07:45:07 UTC
Set target for 2.0
Comment 24 florian 2005-05-16 20:24:01 UTC
Is OK in cws macosx07.
Comment 25 eric.bachard 2005-07-21 22:34:35 UTC
issue closed