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

Re: [Pkg-octave-devel] Sundials



Hi, 

hmm, that's a weird one. Upstream does check for stdint.h, but it seems
to not be used at all?

Anyway, the relevant lines from stdint.h on AMD64 are:

=======================================================================
/* Types for `void *' pointers.  */
#if __WORDSIZE == 64
# ifndef __intptr_t_defined
typedef long int                intptr_t;
#  define __intptr_t_defined
# endif
typedef unsigned long int       uintptr_t;
#else
# ifndef __intptr_t_defined
typedef int                     intptr_t;
#  define __intptr_t_defined
# endif
typedef unsigned int            uintptr_t;
#endif
=======================================================================


I attach a new patch, which doesn't trigger the error messages. But I
think upstream should do this via stdint.h (after all, they are checking
for it in their configure.in).

	Thomas
diff -ur sundials/cvodes/include/cvodea.h sundials-2.2.0.new/cvodes/include/cvodea.h
--- sundials/cvodes/include/cvodea.h	2006-02-15 17:46:59.000000000 +0000
+++ sundials-2.2.0.new/cvodes/include/cvodea.h	2006-06-08 14:46:02.887993632 +0000
@@ -44,6 +44,10 @@
 #include "cvodes.h"
 #include "sundials_nvector.h"
 
+#ifndef HAVE_STDINT_H
+#define uintptr_t unsigned long int
+#endif
+
   /* 
    * ===============================================================
    * DEFINITIONS OF CVODEA INPUTS
@@ -281,8 +285,8 @@
    */
 
   typedef struct {
-    unsigned int my_addr;
-    unsigned int next_addr;
+    uintptr_t my_addr;
+    uintptr_t next_addr;
     realtype t0;
     realtype t1;
     long int nstep;
@@ -291,7 +295,7 @@
   } CVadjCheckPointRec;
 
   int CVadjGetCheckPointsInfo(void *cvadj_mem, CVadjCheckPointRec *ckpnt);
-  int CVadjGetCurrentCheckPoint(void *cvadj_mem, unsigned int *addr);
+  int CVadjGetCurrentCheckPoint(void *cvadj_mem, uintptr_t *addr);
 
   /*
    * -----------------------------------------------------------------
diff -ur sundials/cvodes/source/cvodea_io.c sundials-2.2.0.new/cvodes/source/cvodea_io.c
--- sundials/cvodes/source/cvodea_io.c	2006-02-15 17:47:02.000000000 +0000
+++ sundials-2.2.0.new/cvodes/source/cvodea_io.c	2006-06-08 14:46:26.189451272 +0000
@@ -422,8 +422,8 @@
 
   while (ck_mem != NULL) {
 
-    ckpnt[i].my_addr = (unsigned int) ck_mem;
-    ckpnt[i].next_addr = (unsigned int) next_;
+    ckpnt[i].my_addr = (uintptr_t) ck_mem;
+    ckpnt[i].next_addr = (uintptr_t) next_;
     ckpnt[i].t0 = t0_;
     ckpnt[i].t1 = t1_;
     ckpnt[i].nstep = nst_;
@@ -445,7 +445,7 @@
  *  Returns the address of the 'active' check point.
  */
 
-int CVadjGetCurrentCheckPoint(void *cvadj_mem, unsigned int *addr)
+int CVadjGetCurrentCheckPoint(void *cvadj_mem, uintptr_t *addr)
 {
   CVadjMem ca_mem;
 
@@ -455,7 +455,7 @@
   }
   ca_mem = (CVadjMem) cvadj_mem;
 
-  *addr = (unsigned int) ckpntData;
+  *addr = (uintptr_t) ckpntData;
 
   return(CV_SUCCESS);
 }
Only in sundials-2.2.0.new/: debian
Only in sundials-2.2.0.new/: include
diff -ur sundials/kinsol/source/kinsol.c sundials-2.2.0.new/kinsol/source/kinsol.c
--- sundials/kinsol/source/kinsol.c	2006-03-18 00:14:09.000000000 +0000
+++ sundials-2.2.0.new/kinsol/source/kinsol.c	2006-06-08 15:01:39.823557776 +0000
@@ -64,6 +64,10 @@
 #include <stdarg.h>
 #include <math.h>
 
+#ifndef HAVE_STDINT_H
+#define intptr_t long int
+#endif
+
 #include "kinsol_impl.h"
 #include "sundials_math.h"
 
@@ -1737,7 +1741,7 @@
 
     /* If info_code = PRNT_RETVAL, decode the numeric value */
 
-    ret = (int) (va_arg(ap, int *));
+    ret = (intptr_t) (va_arg(ap, int *));
 
     switch(ret) {
     case KIN_SUCCESS:

Reply to: