changeset 30435:1f0a2689cab2 stable

Use forward declarations for octave_int<T> where possible (bug #59820). * liboctave/util/oct-inttypes-fwd.h: Forward declare template with correct visibility settings. * liboctave/array/idx-vector.h: Include header with complete declaration. * liboctave/util/oct-inttypes.h, libinterp/corefcn/mx-type-traits.h, libinterp/octave-value/ov-base-scalar.cc, libinterp/octave-value/ov-bool.cc, libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-magic-int.cc, libinterp/octave-value/ov-magic-int.h, libinterp/octave-value/ov-scalar.cc, liboctave/array/Array-i.cc, liboctave/array/MArray-i.cc, liboctave/numeric/sparse-dmsolve.cc, liboctave/operators/mx-inlines.cc: Include header with forward declaration.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 05 Dec 2021 11:23:41 +0100
parents c6cd2f582254
children 16929875995b e3df47a19871
files libinterp/corefcn/mx-type-traits.h libinterp/octave-value/ov-base-scalar.cc libinterp/octave-value/ov-bool.cc libinterp/octave-value/ov-float.cc libinterp/octave-value/ov-magic-int.cc libinterp/octave-value/ov-magic-int.h libinterp/octave-value/ov-scalar.cc liboctave/array/Array-i.cc liboctave/array/MArray-i.cc liboctave/array/idx-vector.h liboctave/numeric/sparse-dmsolve.cc liboctave/operators/mx-inlines.cc liboctave/util/oct-inttypes-fwd.h liboctave/util/oct-inttypes.h
diffstat 14 files changed, 14 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/mx-type-traits.h	Sun Dec 05 10:52:55 2021 +0100
+++ b/libinterp/corefcn/mx-type-traits.h	Sun Dec 05 11:23:41 2021 +0100
@@ -29,7 +29,7 @@
 #include "octave-config.h"
 
 #include "mxtypes.h"
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 template <typename T>
 class
--- a/libinterp/octave-value/ov-base-scalar.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/libinterp/octave-value/ov-base-scalar.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -30,7 +30,7 @@
 #include <ostream>
 #include <sstream>
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 #include "ovl.h"
 #include "ov-base.h"
--- a/libinterp/octave-value/ov-bool.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/libinterp/octave-value/ov-bool.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -30,7 +30,7 @@
 #include <istream>
 #include <ostream>
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 #include "mx-base.h"
 
--- a/libinterp/octave-value/ov-float.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/libinterp/octave-value/ov-float.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -30,7 +30,7 @@
 #include <istream>
 #include <ostream>
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 #include "data-conv.h"
 #include "mach-info.h"
--- a/libinterp/octave-value/ov-magic-int.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/libinterp/octave-value/ov-magic-int.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -30,7 +30,7 @@
 #include <istream>
 #include <ostream>
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 #include "data-conv.h"
 #include "mach-info.h"
--- a/libinterp/octave-value/ov-magic-int.h	Sun Dec 05 10:52:55 2021 +0100
+++ b/libinterp/octave-value/ov-magic-int.h	Sun Dec 05 11:23:41 2021 +0100
@@ -31,7 +31,7 @@
 #include <iosfwd>
 #include <string>
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 #include "ov-base.h"
 #include "ov-re-mat.h"
--- a/libinterp/octave-value/ov-scalar.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/libinterp/octave-value/ov-scalar.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -30,7 +30,7 @@
 #include <istream>
 #include <ostream>
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 #include "data-conv.h"
 #include "mach-info.h"
--- a/liboctave/array/Array-i.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/liboctave/array/Array-i.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -27,7 +27,7 @@
 #  include "config.h"
 #endif
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 // Instantiate Arrays of integer values.
 
--- a/liboctave/array/MArray-i.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/liboctave/array/MArray-i.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -27,7 +27,7 @@
 #  include "config.h"
 #endif
 
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 
 // Instantiate MArrays of int values.
 
--- a/liboctave/array/idx-vector.h	Sun Dec 05 10:52:55 2021 +0100
+++ b/liboctave/array/idx-vector.h	Sun Dec 05 11:23:41 2021 +0100
@@ -37,7 +37,7 @@
 
 #include "Array-fwd.h"
 #include "dim-vector.h"
-#include "oct-inttypes-fwd.h"
+#include "oct-inttypes.h"
 #include "oct-refcount.h"
 #include "Sparse-fwd.h"
 
--- a/liboctave/numeric/sparse-dmsolve.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/liboctave/numeric/sparse-dmsolve.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -36,7 +36,7 @@
 #include "MatrixType.h"
 #include "dSparse.h"
 #include "lo-error.h"
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 #include "oct-locbuf.h"
 #include "oct-sort.h"
 #include "oct-sparse.h"
--- a/liboctave/operators/mx-inlines.cc	Sun Dec 05 10:52:55 2021 +0100
+++ b/liboctave/operators/mx-inlines.cc	Sun Dec 05 11:23:41 2021 +0100
@@ -38,7 +38,7 @@
 #include "Array.h"
 #include "bsxfun.h"
 #include "oct-cmplx.h"
-#include "oct-inttypes.h"
+#include "oct-inttypes-fwd.h"
 #include "oct-locbuf.h"
 
 // Provides some commonly repeated, basic loop templates.
--- a/liboctave/util/oct-inttypes-fwd.h	Sun Dec 05 10:52:55 2021 +0100
+++ b/liboctave/util/oct-inttypes-fwd.h	Sun Dec 05 11:23:41 2021 +0100
@@ -28,7 +28,7 @@
 
 #include "octave-config.h"
 
-template <typename T> class octave_int;
+template <typename T> class OCTAVE_API octave_int;
 
 typedef octave_int<int8_t> octave_int8;
 typedef octave_int<int16_t> octave_int16;
--- a/liboctave/util/oct-inttypes.h	Sun Dec 05 10:52:55 2021 +0100
+++ b/liboctave/util/oct-inttypes.h	Sun Dec 05 11:23:41 2021 +0100
@@ -36,18 +36,7 @@
 
 #include "lo-mappers.h"
 #include "lo-traits.h"
-
-template <typename T> class octave_int;
-
-typedef octave_int<int8_t> octave_int8;
-typedef octave_int<int16_t> octave_int16;
-typedef octave_int<int32_t> octave_int32;
-typedef octave_int<int64_t> octave_int64;
-
-typedef octave_int<uint8_t> octave_uint8;
-typedef octave_int<uint16_t> octave_uint16;
-typedef octave_int<uint32_t> octave_uint32;
-typedef octave_int<uint64_t> octave_uint64;
+#include "oct-inttypes-fwd.h"
 
 #if defined (OCTAVE_INT_USE_LONG_DOUBLE)
 
@@ -1351,5 +1340,4 @@
 
 #undef OCTAVE_INT_IDX_TYPE_BIN_OP
 
-
 #endif