changeset 22915:7766e3ef6c69

* __ode15__.cc: Avoid old-style cast warnings.
author John W. Eaton <jwe@octave.org>
date Fri, 16 Dec 2016 12:03:33 -0500
parents b7ffd93b8d06
children 1632fb20b60b
files libinterp/dldfcn/__ode15__.cc
diffstat 1 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__ode15__.cc	Fri Dec 16 11:52:59 2016 -0500
+++ b/libinterp/dldfcn/__ode15__.cc	Fri Dec 16 12:03:33 2016 -0500
@@ -48,6 +48,25 @@
 #    include <nvector/nvector_serial.h>
 #  endif
 
+static inline realtype *
+nv_data_s (N_Vector& v)
+{
+#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
+// Disable warning from GCC about old-style casts in Sundials macro
+// expansions.  Do this in a function so that this diagnostic may still
+// be enabled for the rest of the file.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
+
+  return NV_DATA_S (v);
+  
+#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
+// Restore prevailing warning state for remainder of the file.
+#pragma GCC diagnostic pop
+#endif
+}
+
 namespace octave
 {
   class IDA
@@ -303,7 +322,7 @@
       (*fun) (y, yp, t, ida_fun);
 
     realtype *puntrr =
-      NV_DATA_S (rr);
+      nv_data_s (rr);
 
     for (octave_idx_type i = 0; i < num; i++)
       puntrr [i] = res (i);
@@ -411,7 +430,7 @@
   {
     ColumnVector data (n);
     realtype *punt;
-    punt = NV_DATA_S (v);
+    punt = nv_data_s (v);
 
     for (octave_idx_type i = 0; i < n; i++)
       data (i) = punt [i];
@@ -426,7 +445,7 @@
       N_VNew_Serial (n);
 
     realtype * punt;
-    punt = NV_DATA_S (v);
+    punt = nv_data_s (v);
 
     for (octave_idx_type i = 0; i < n; i++)
       punt [i] = data (i);