changeset 29225:a65ff1d4f75b

Remove API tag when instantiating Array template class (patch #8919). * liboctave/array/Array.cc (INSTANTIATE_ARRAY): Remove argument API because it is ignored on previously defined template class instantiations. * libinterp/template-inst/Array-jit.cc, libinterp/template-inst/Array-tc.cc, liboctave/array/Array-b.cc, liboctave/array/Array-C.cc, liboctave/array/Array-ch.cc, liboctave/array/Array-d.cc, liboctave/array/Array-f.cc, liboctave/array/Array-fC.cc, liboctave/array/Array-i.cc, liboctave/array/Array-idx-vec.cc, liboctave/array/Array-s.cc, liboctave/array/Array-str.cc, liboctave/array/Array-voidp.cc: Remove API tag on template class instantiations.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 29 Dec 2020 17:19:47 +0100
parents cc4a4df4e32f
children 3ef055ca1d5e
files libinterp/template-inst/Array-jit.cc libinterp/template-inst/Array-tc.cc liboctave/array/Array-C.cc liboctave/array/Array-b.cc liboctave/array/Array-ch.cc liboctave/array/Array-d.cc liboctave/array/Array-f.cc liboctave/array/Array-fC.cc liboctave/array/Array-i.cc liboctave/array/Array-idx-vec.cc liboctave/array/Array-s.cc liboctave/array/Array-str.cc liboctave/array/Array-voidp.cc liboctave/array/Array.cc
diffstat 14 files changed, 93 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/template-inst/Array-jit.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/libinterp/template-inst/Array-jit.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -37,12 +37,16 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
 NO_INSTANTIATE_ARRAY_SORT (octave::jit_function);
 
-INSTANTIATE_ARRAY (octave::jit_function, OCTINTERP_API);
+// Visibility attributes are ignored on template instantiation.
+// As a work-around, set visibility to default overriding compiler options.
+#pragma GCC visibility push(default)
+INSTANTIATE_ARRAY (octave::jit_function);
+#pragma GCC visibility pop
 
 #if defined (Cell_h)
 #  error Must not include Cell.h in Array-jit.h
--- a/libinterp/template-inst/Array-tc.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/libinterp/template-inst/Array-tc.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -41,21 +41,26 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<Complex>;
-extern template class OCTAVE_API Array<FloatComplex>;
-extern template class OCTAVE_API Array<bool>;
-extern template class OCTAVE_API Array<char>;
-extern template class OCTAVE_API Array<double>;
-extern template class OCTAVE_API Array<float>;
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
-extern template class OCTAVE_API Array<std::string>;
+extern template class Array<Complex>;
+extern template class Array<FloatComplex>;
+extern template class Array<bool>;
+extern template class Array<char>;
+extern template class Array<double>;
+extern template class Array<float>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
+extern template class Array<std::string>;
 
+// Visibility attributes are ignored on template instantiation.
+// As a work-around, set visibility to default overriding compiler options.
+#pragma GCC visibility push(default)
 NO_INSTANTIATE_ARRAY_SORT (octave_value);
-INSTANTIATE_ARRAY (octave_value, OCTINTERP_API);
+INSTANTIATE_ARRAY (octave_value);
 
 NO_INSTANTIATE_ARRAY_SORT (octave_value *);
-INSTANTIATE_ARRAY (octave_value *, OCTINTERP_API);
+INSTANTIATE_ARRAY (octave_value *);
 
 NO_INSTANTIATE_ARRAY_SORT (octave::cdef_object);
-INSTANTIATE_ARRAY (octave::cdef_object, OCTINTERP_API);
+INSTANTIATE_ARRAY (octave::cdef_object);
+#pragma GCC visibility pop
+
--- a/liboctave/array/Array-C.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-C.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -39,8 +39,8 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
 template <>
 inline bool
@@ -92,9 +92,9 @@
   return result;
 }
 
-template class OCTAVE_API octave_sort<Complex>;
+template class octave_sort<Complex>;
 
-INSTANTIATE_ARRAY (Complex, OCTAVE_API);
+INSTANTIATE_ARRAY (Complex);
 
 template OCTAVE_API std::ostream& operator << (std::ostream&,
                                                const Array<Complex>&);
@@ -102,4 +102,4 @@
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class OCTAVE_API DiagArray2<Complex>;
+template class DiagArray2<Complex>;
--- a/liboctave/array/Array-b.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-b.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -39,8 +39,8 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
 // Specialize bool sorting (aka stable partitioning).
 
@@ -118,9 +118,9 @@
   do_bool_partition<true> (data, idx, nel);
 }
 
-template class OCTAVE_API octave_sort<bool>;
+template class octave_sort<bool>;
 
-INSTANTIATE_ARRAY (bool, OCTAVE_API);
+INSTANTIATE_ARRAY (bool);
 
 template OCTAVE_API std::ostream& operator << (std::ostream&,
                                                const Array<bool>&);
@@ -128,4 +128,4 @@
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class OCTAVE_API DiagArray2<bool>;
+template class DiagArray2<bool>;
--- a/liboctave/array/Array-ch.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-ch.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -39,12 +39,12 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
-template class OCTAVE_API octave_sort<char>;
+template class octave_sort<char>;
 
-INSTANTIATE_ARRAY (char, OCTAVE_API);
+INSTANTIATE_ARRAY (char);
 
 template OCTAVE_API std::ostream& operator << (std::ostream&,
                                                const Array<char>&);
@@ -52,4 +52,4 @@
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class OCTAVE_API DiagArray2<char>;
+template class DiagArray2<char>;
--- a/liboctave/array/Array-d.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-d.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -41,8 +41,8 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
 template <>
 inline bool
@@ -163,9 +163,9 @@
   return mode;
 }
 
-template class OCTAVE_API octave_sort<double>;
+template class octave_sort<double>;
 
-INSTANTIATE_ARRAY (double, OCTAVE_API);
+INSTANTIATE_ARRAY (double);
 
 template OCTAVE_API std::ostream& operator << (std::ostream&,
                                                const Array<double>&);
@@ -173,4 +173,4 @@
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class OCTAVE_API DiagArray2<double>;
+template class DiagArray2<double>;
--- a/liboctave/array/Array-f.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-f.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -41,8 +41,8 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
 template <>
 inline bool
@@ -163,9 +163,9 @@
   return mode;
 }
 
-template class OCTAVE_API octave_sort<float>;
+template class octave_sort<float>;
 
-INSTANTIATE_ARRAY (float, OCTAVE_API);
+INSTANTIATE_ARRAY (float);
 
 template OCTAVE_API std::ostream& operator << (std::ostream&,
                                                const Array<float>&);
@@ -173,4 +173,4 @@
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class OCTAVE_API DiagArray2<float>;
+template class DiagArray2<float>;
--- a/liboctave/array/Array-fC.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-fC.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -39,8 +39,8 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
 template <>
 inline bool
@@ -92,9 +92,9 @@
   return result;
 }
 
-template class OCTAVE_API octave_sort<FloatComplex>;
+template class octave_sort<FloatComplex>;
 
-INSTANTIATE_ARRAY (FloatComplex, OCTAVE_API);
+INSTANTIATE_ARRAY (FloatComplex);
 
 template OCTAVE_API std::ostream& operator << (std::ostream&,
                                                const Array<FloatComplex>&);
@@ -102,4 +102,4 @@
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class OCTAVE_API DiagArray2<FloatComplex>;
+template class DiagArray2<FloatComplex>;
--- a/liboctave/array/Array-i.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-i.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -41,41 +41,41 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
+extern template class Array<idx_vector>;
 
-template class OCTAVE_API octave_sort<int>;
-template class OCTAVE_API octave_sort<long>;
+template class octave_sort<int>;
+template class octave_sort<long>;
 #if defined (OCTAVE_HAVE_LONG_LONG_INT)
-template class OCTAVE_API octave_sort<long long>;
+template class octave_sort<long long>;
 #endif
 
-INSTANTIATE_ARRAY (int, OCTAVE_API);
-INSTANTIATE_ARRAY (long, OCTAVE_API);
+INSTANTIATE_ARRAY (int);
+INSTANTIATE_ARRAY (long);
 #if defined (OCTAVE_HAVE_LONG_LONG_INT)
-INSTANTIATE_ARRAY (long long, OCTAVE_API);
+INSTANTIATE_ARRAY (long long);
 #endif
 
-template class OCTAVE_API octave_sort<octave_int8>;
-template class OCTAVE_API octave_sort<octave_int16>;
-template class OCTAVE_API octave_sort<octave_int32>;
-template class OCTAVE_API octave_sort<octave_int64>;
+template class octave_sort<octave_int8>;
+template class octave_sort<octave_int16>;
+template class octave_sort<octave_int32>;
+template class octave_sort<octave_int64>;
 
-INSTANTIATE_ARRAY (octave_int8, OCTAVE_API);
-INSTANTIATE_ARRAY (octave_int16, OCTAVE_API);
-INSTANTIATE_ARRAY (octave_int32, OCTAVE_API);
-INSTANTIATE_ARRAY (octave_int64, OCTAVE_API);
+INSTANTIATE_ARRAY (octave_int8);
+INSTANTIATE_ARRAY (octave_int16);
+INSTANTIATE_ARRAY (octave_int32);
+INSTANTIATE_ARRAY (octave_int64);
 
-template class OCTAVE_API octave_sort<octave_uint8>;
-template class OCTAVE_API octave_sort<octave_uint16>;
-template class OCTAVE_API octave_sort<octave_uint32>;
-template class OCTAVE_API octave_sort<octave_uint64>;
+template class octave_sort<octave_uint8>;
+template class octave_sort<octave_uint16>;
+template class octave_sort<octave_uint32>;
+template class octave_sort<octave_uint64>;
 
-INSTANTIATE_ARRAY (octave_uint8, OCTAVE_API);
-INSTANTIATE_ARRAY (octave_uint16, OCTAVE_API);
-INSTANTIATE_ARRAY (octave_uint32, OCTAVE_API);
-INSTANTIATE_ARRAY (octave_uint64, OCTAVE_API);
+INSTANTIATE_ARRAY (octave_uint8);
+INSTANTIATE_ARRAY (octave_uint16);
+INSTANTIATE_ARRAY (octave_uint32);
+INSTANTIATE_ARRAY (octave_uint64);
 
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
 
-template class OCTAVE_API DiagArray2<int>;
+template class DiagArray2<int>;
--- a/liboctave/array/Array-idx-vec.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-idx-vec.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -37,8 +37,8 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<octave_idx_type>;
 
 NO_INSTANTIATE_ARRAY_SORT (idx_vector);
 
-INSTANTIATE_ARRAY (idx_vector, OCTAVE_API);
+INSTANTIATE_ARRAY (idx_vector);
--- a/liboctave/array/Array-s.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-s.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -39,12 +39,12 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
-template class OCTAVE_API octave_sort<short>;
+template class octave_sort<short>;
 
-INSTANTIATE_ARRAY (short, OCTAVE_API);
+INSTANTIATE_ARRAY (short);
 
 #include "DiagArray2.h"
 #include "DiagArray2.cc"
--- a/liboctave/array/Array-str.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-str.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -39,9 +39,9 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
-template class OCTAVE_API octave_sort<std::string>;
+template class octave_sort<std::string>;
 
-INSTANTIATE_ARRAY (std::string, OCTAVE_API);
+INSTANTIATE_ARRAY (std::string);
--- a/liboctave/array/Array-voidp.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array-voidp.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -37,9 +37,9 @@
 // Prevent implicit instantiations on some systems (Windows, others?)
 // that can lead to duplicate definitions of static data members.
 
-extern template class OCTAVE_API Array<idx_vector>;
-extern template class OCTAVE_API Array<octave_idx_type>;
+extern template class Array<idx_vector>;
+extern template class Array<octave_idx_type>;
 
 NO_INSTANTIATE_ARRAY_SORT (void *);
 
-INSTANTIATE_ARRAY (void *, OCTAVE_API);
+INSTANTIATE_ARRAY (void *);
--- a/liboctave/array/Array.cc	Tue Dec 29 16:33:56 2020 +0100
+++ b/liboctave/array/Array.cc	Tue Dec 29 17:19:47 2020 +0100
@@ -2764,9 +2764,9 @@
   T::__xXxXx__ ();
 }
 
-#define INSTANTIATE_ARRAY(T, API)                       \
+#define INSTANTIATE_ARRAY(T)                            \
   template <> void Array<T>::instantiation_guard () { } \
-  template class API Array<T>
+  template class Array<T>
 
 // FIXME: is this used?