changeset 20318:a0fab64685ab

Avoid HAVE_ macro in header file. * sparse-util.h, sparse-util.cc (SparseCholError, SparseCholPrint): Unconditionally declare and define functions.
author John W. Eaton <jwe@octave.org>
date Wed, 24 Jun 2015 17:32:36 -0400
parents 5db7eea18d76
children 085c99b96aed
files liboctave/util/sparse-util.cc liboctave/util/sparse-util.h
diffstat 2 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/sparse-util.cc	Wed Jun 24 14:40:22 2015 -0400
+++ b/liboctave/util/sparse-util.cc	Wed Jun 24 17:32:36 2015 -0400
@@ -33,14 +33,14 @@
 
 // FIXME: this overload is here due to API change in SuiteSparse (3.1 -> 3.2)
 
-#ifdef HAVE_CHOLMOD
-
 void
 SparseCholError (int status, char *file, int line, char *message)
 {
   SparseCholError (status, file, line, message);
 }
 
+#ifdef HAVE_CHOLMOD
+
 void
 SparseCholError (int status, const char *file, int line, const char *message)
 {
@@ -53,6 +53,15 @@
        status, line, file, message);
 }
 
+#else
+
+void
+SparseCholError (int status, const char *, int, const char *)
+{
+}
+
+#endif //HAVE_CHOLMOD
+
 int
 SparseCholPrint (const char *fmt, ...)
 {
@@ -64,8 +73,6 @@
   return ret;
 }
 
-#endif //HAVE_CHOLMOD
-
 bool
 sparse_indices_ok (octave_idx_type *r, octave_idx_type *c,
                    octave_idx_type nrows, octave_idx_type ncols,
--- a/liboctave/util/sparse-util.h	Wed Jun 24 14:40:22 2015 -0400
+++ b/liboctave/util/sparse-util.h	Wed Jun 24 17:32:36 2015 -0400
@@ -24,16 +24,18 @@
 #if !defined (octave_sparse_util_h)
 #define octave_sparse_util_h 1
 
-#ifdef HAVE_CHOLMOD
+// The next two functions don't do anything unless CHOLMOD is
+// available
 
 // FIXME this overload is here due to API change in SuiteSparse (3.1 -> 3.2)
-extern OCTAVE_API void SparseCholError (int status, char *file,
-                                        int line, char *message);
-extern OCTAVE_API void SparseCholError (int status, const char *file,
-                                        int line, const char *message);
-extern OCTAVE_API int SparseCholPrint (const char *fmt, ...);
+extern OCTAVE_API void
+SparseCholError (int status, char *file, int line, char *message);
 
-#endif //HAVE_CHOLMOD
+extern OCTAVE_API void
+SparseCholError (int status, const char *file, int line, const char *message);
+
+extern OCTAVE_API int
+SparseCholPrint (const char *fmt, ...);
 
 extern OCTAVE_API bool
 sparse_indices_ok (octave_idx_type *r, octave_idx_type *c,