pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/25716: pkgsrc/misc/kdeutils3



>Number:         25716
>Category:       pkg
>Synopsis:       Package does not compile with gcc 3.4.0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 26 12:51:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     John R. Shannon
>Release:        NetBSD 2.0_BETA
>Organization:
        johnrshannon.com
>Environment:
System: NetBSD colleen.internal.johnrshannon.com 2.0_BETA NetBSD 2.0_BETA 
(KERNEL) #0: Mon May 24 05:31:10 MDT 2004 
root%colleen.internal.johnrshannon.com@localhost:/usr/obj/usr/src/sys/arch/i386/compile/KERNEL
 i386
Architecture: i386
Machine: i386
>Description:
        Package does not compile with gcc 3.4.0. Most of the problems come from
        NetBSD not implementing all the required math function for type long 
        double (supported in 3.4.0 but not NetBSD's system compiler). Other
        problems come from more thorough semantic checking in 3.4.0. The
        missing long double function problem can be rectified by using the
        functions in libstdc++v3 (if available); this is the approach taken in
        my supplied pathes.
>How-To-Repeat:
        Build with wip/gcc-3.4
>Fix:
        Apply the followwing patches:

$NetBSD$

--- ./kcalc/kcalc_core.cpp.orig 2004-05-24 14:35:40.000000000 -0600
+++ ./kcalc/kcalc_core.cpp
@@ -858,7 +858,7 @@ void CalcEngine::StatSumSquares(CALCAMNT
 
 void CalcEngine::Tangens(CALCAMNT input)
 {
-       CALCAMNT tmp = input;
+       CALCAMNT aux, tmp = input;
 
        switch (_angle_mode)
        {
@@ -873,9 +873,20 @@ void CalcEngine::Tangens(CALCAMNT input)
                break;
        }
 
-       _last_result = TAN(tmp);
+       aux = tmp;
+        // make aux positive
+       if (aux < 0) aux = -aux;
+       // put aux between 0 and pi
+       while (aux > pi) aux -= pi;
+       // if were are really close to pi/2 throw an error
+       // tan(pi/2) => inf
+       // using the 10 factor because without it 270º tan still gave a result
+       if ( (aux - pi/2 < POS_ZERO * 10) && (aux - pi/2 > NEG_ZERO * 10) )
+               _error = true;
+       else
+               _last_result = TAN(tmp);
 
-       // Now a cheat to help the weird case of COS 90 degrees not being 0!!!
+       // Now a cheat to help the weird case of TAN 0 degrees not being 0!!!
        if (_last_result < POS_ZERO && _last_result > NEG_ZERO)
                _last_result = 0.0;
 


$NetBSD$

--- ./kcalc/kcalcdisplay.cpp.orig       2004-04-04 03:16:17.000000000 -0600
+++ ./kcalc/kcalcdisplay.cpp
@@ -38,7 +38,8 @@ static CALCAMNT toDouble(const QString &
 {
        char *ptr = 0;
        errno = 0;
-       CALCAMNT result = (CALCAMNT) STRTOD(s.latin1(),&ptr);
+       CALCAMNT result = 0;
+       sscanf(s.latin1(), "%Lf", &result);
 
        // find first non-space character for check below
        while (ptr != 0 && *ptr != '\0' && isspace(*ptr)) {



$NetBSD$

--- kcalc/kcalcdisplay.h.orig   2004-02-28 02:55:17.000000000 -0700
+++ kcalc/kcalcdisplay.h
@@ -26,10 +26,9 @@
 #ifndef _D_KCALCDISPLAY_H_
 #define _D_KCALCDISPLAY_H_
 
-#include <stdlib.h>
+#include "kcalctype.h"
 #include <qlabel.h>
 #include <qtimer.h>
-#include "kcalctype.h"
 
 
 #ifdef HAVE_LONG_DOUBLE


$NetBSD$

--- kcalc/kcalctype.h.orig      2004-04-04 03:16:17.000000000 -0600
+++ kcalc/kcalctype.h
@@ -30,6 +30,55 @@
 #ifndef KCALC_TYPE_H
 #define KCALC_TYPE_H
 
+// NetBSD lacks all the required math functions for long double. If
+// we're using gcc > 3, they're available in libstdc++-v3:
+#if __GNUC__ > 3
+#include <climits>
+#include <cmath>
+#include <cstdlib>  // For strof, strtold
+
+using namespace std;
+
+#ifdef HAVE_LONG_DOUBLE
+/* should be detected by autoconf and defined in config.h
+   Be carefull when modifying these lines. HAVE_LONG_DOUBLE
+   is used all over kcalc's sources to determine whether 
+   long double of double is the fundamental data type for kcalc*/
+
+
+
+       typedef long double CALCAMNT;
+       #define STRTOD(X,Y)     strtold(X,Y)
+#else
+       typedef double CALCAMNT;
+       #define STRTOD(X,Y)     strtod(X,Y)
+#endif
+
+#define FABS(X)        fabs(X)
+#define MODF(X,Y)      modf((double)X,(double*)Y)
+#define FMOD(X,Y)      fmod((double)X,(double)Y)
+#define SIN(X)         sin(X)
+#define ASIN(X)        asin((double)X)
+#define SINH(X)        sinh(X)
+#define ASINH(X)       asinh(X)
+#define COS(X)         cos(X)
+#define COSH(X)        cosh(X)
+#define ACOS(X)        acos((double)X)
+#define ACOSH(X)       acosh(X)
+#define TAN(X)         tan(X)
+#define TANH(X)        tanh(X)
+#define ATAN(X)        atan((double)X)
+#define ATANH(X)       atanh(X)
+#define EXP(X)         exp(X)
+#define POW(X,Y)       pow(X,Y)
+#define LN(X)          log(X)
+#define LOG_TEN(X)     log10(X)
+#define SQRT(X)        sqrt(X)
+#define ISINF(X)       isinf(X)
+
+#else
+// Use pre-patch code with HAVE_LONG_DOUBLE undef'd
+
 #include <limits.h>
 #include <math.h>
 
@@ -38,10 +87,9 @@
 
 // Undefine HAVE_LONG_DOUBLE for Beta 4 since RedHat 5.0 comes with a borken
 // glibc
-
-//#ifdef HAVE_LONG_DOUBLE
-//#undef HAVE_LONG_DOUBLE
-//#endif
+#ifdef HAVE_LONG_DOUBLE
+#undef HAVE_LONG_DOUBLE
+#endif
 
 #ifdef HAVE_LONG_DOUBLE
 /* should be detected by autoconf and defined in config.h
@@ -107,6 +155,9 @@
 #endif
 
 #undef HAVE_LONG_LONG
+
+#endif
+
 #if defined(LLONG_MAX) && defined(HAVE_LONG_DOUBLE)
 #define KCALC_LONG_MIN LLONG_MIN
 #define KCALC_LONG_MAX LLONG_MAX


$NetBSD$

--- ./ksim/ksimview.cpp.orig    2004-05-25 08:03:51.000000000 -0600
+++ ./ksim/ksimview.cpp
@@ -272,12 +272,14 @@ void KSim::MainView::reparseConfig(bool 
   for (it = list.begin(); it != list.end(); ++it) {
     if ((*it).isDifferent()) {
       if ((*it).isEnabled()) { // Go through the added/removed plugins and 
load/unload them
-        addPlugin(KDesktopFile((*it).filename()));
+        const KDesktopFile kdf((*it).filename());
+        addPlugin(kdf);
         m_prefDialog->createPage((*it).libName());
       }
       else {
         m_prefDialog->removePage((*it).libName());
-        removePlugin(KDesktopFile((*it).filename()));
+        const KDesktopFile kdf((*it).filename());
+        removePlugin(kdf);
       }
     }
   }
@@ -304,7 +306,10 @@ void KSim::MainView::addPlugins()
   QStringList locatedFiles = KGlobal::dirs()->findAllResources("data", 
"ksim/monitors/*.desktop");
   QStringList::ConstIterator it;
   for (it = locatedFiles.begin(); it != locatedFiles.end(); ++it)
-    addPlugin(KDesktopFile(*it, true));
+  {
+    const KDesktopFile kdf(*it, true);
+    addPlugin(kdf);
+  }
 }
 
 void KSim::MainView::addPlugin(const KDesktopFile &file, bool force)


$NetBSD$

--- ksim/library/themeloader.h.orig     2004-05-25 08:15:13.000000000 -0600
+++ ksim/library/themeloader.h
@@ -45,6 +45,7 @@ namespace KSim
   class Theme
   {
     friend class ThemeLoader;
+    friend class ThemePrefs;
     public:
       enum PixmapType { KrellPanel = 0, KrellMeter, KrellSlider };
       ~Theme();
>Release-Note:
>Audit-Trail:
>Unformatted:



Home | Main Index | Thread Index | Old Index