Summary: | isinf declaration problem in knumber.cpp | ||
---|---|---|---|
Product: | [Applications] kcalc | Reporter: | Jens Hatlak <jh> |
Component: | general | Assignee: | Klaus Niederkrüger <kniederk> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | stevee |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Solaris | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | isinf patch, verbatim copy from kcalc_core.cpp |
Description
Jens Hatlak
2006-10-13 14:01:12 UTC
FYI: I know the Product is wrong, but the wizard does not allow to select kdeutils or kcalc... On Solaris isinf() is declared in <sunmath.h>, so including that will probably solve the problem. Having just tried including <sunmath.h>, it doesn't solve the problem :-( I should have checked before posting. The man page says: NAME ieee_sun, fp_class, isinf, isnormal, issubnormal, iszero, signbit, nonstandard_arithmetic, standard_arithmetic, ieee_retrospective - miscellaneous functions for IEEE arith- metic SYNOPSIS cc [ flag ... ] file ... -lsunmath -lm [ library ... ] #include <sunmath.h> enum fp_class_type fp_class(double x); int isinf(double x); but I don't appear to have a sunmath.h include file, so I get this error: knumber.cpp:22:21: sunmath.h: No such file or directory I do not have sunmath.h on my machine anyway (Solaris 5.8). Also, configure already seems to check for isinf(): checking for isinf in -lm... no So kcalc should honor that (check HAVE_FUNC_ISINF). Also interesting is that there is a custom isinf function in kcalc_core.cpp. Maybe one could use that implementation. I don't know (did only search for the name). It seems I'll have to do this myself - again... kcalc/kcalc_core.cpp contains the following code lines: #ifndef HAVE_FUNC_ISINF #ifdef HAVE_IEEEFP_H #include <ieeefp.h> #else #include <math.h> #endif int isinf(double x) { return !finite(x) && x==x; } #endif This works for knumber/knumber.cpp as well. Simple copy-paste. Attaching patch, please check in. Created attachment 18487 [details]
isinf patch, verbatim copy from kcalc_core.cpp
Stop, back to start. I get: ld: fatal: symbol `isinf' is multiply-defined: (file .libs/kcalc_core.o type=FUNC; file .libs/libkdeinit_kcalc.lax/libknumber.a/knumber.o type=FUNC); needs further investigation. :-( I'm not a programmer, so this is just a wild guess: Maybe it would work if these lines would be moved to a header file which would then be included by both kcalc/kcalc_core.cpp and kcalc/knumber/knumber.cpp. Help! A simple solution is to add static to the start of the function definition. However this could mean a proliferation of identical functions. An alternative would be to make isinf a macro. An even better solution would be to add it to the library kdefakes in kdelibs so that all of KDE could use it. The problem still exists in KDE-3.5.6 The problem still exists in KDE-3.5.7 SVN commit 681344 by aseigo: build on systems that don't have isinf, such as various solaris versions based on a patch by Jens Hatlak BUGS:135589 M +11 -0 knumber.cpp --- trunk/KDE/kdeutils/kcalc/knumber/knumber.cpp #681343:681344 @@ -45,6 +45,17 @@ bool KNumber::_fraction_input = false; bool KNumber::_splitoffinteger_output = false; +#ifndef HAVE_FUNC_ISINF + +#ifdef HAVE_IEEEEFP_H +#include <ieeefp.h> +#else +#include <math.h> +#endif + +#define isinf(x) !finite(x) && x == x +#endif + KNumber::KNumber(qint32 num) { _num = new _knuminteger(num); The patch works for KDE-3.5.7 as well, thx, but it has a small type: wrong: http://websvn.kde.org/trunk/KDE/kdeutils/kcalc/knumber/knumber.cpp?r1=661111&r2=681344 +#ifdef HAVE_IEEEEFP_H right: +#ifdef HAVE_IEEEFP_H |