diff --git a/src/google/protobuf/repeated_field.cc b/src/google/protobuf/repeated_field.cc index 3f20db1baa..de3a982ef6 100644 --- a/src/google/protobuf/repeated_field.cc +++ b/src/google/protobuf/repeated_field.cc @@ -107,25 +107,6 @@ PROTOBUF_EXPORT_TEMPLATE_DEFINE void RepeatedField::CopyArray( } } -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; - -namespace internal { -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; -} // namespace internal } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 8e6295e885..f765a0c57f 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -1032,36 +1032,40 @@ struct ElementCopier { // some specializations for them. Some definitions are in the .cc file. template <> -inline void RepeatedField::RemoveLast() { +PROTOBUF_EXPORT inline void RepeatedField::RemoveLast() { GOOGLE_ABSL_DCHECK_GT(current_size_, 0); Mutable(size() - 1)->Clear(); ExchangeCurrentSize(current_size_ - 1); } template <> -void RepeatedField::Clear(); +PROTOBUF_EXPORT void RepeatedField::Clear(); template <> -inline void RepeatedField::SwapElements(int index1, int index2) { +PROTOBUF_EXPORT inline void RepeatedField::SwapElements( + int index1, int index2) { Mutable(index1)->swap(*Mutable(index2)); } template <> -size_t RepeatedField::SpaceUsedExcludingSelfLong() const; +PROTOBUF_EXPORT size_t +RepeatedField::SpaceUsedExcludingSelfLong() const; template <> -void RepeatedField::Truncate(int new_size); +PROTOBUF_EXPORT void RepeatedField::Truncate(int new_size); template <> -void RepeatedField::Resize(int new_size, const absl::Cord& value); +PROTOBUF_EXPORT void RepeatedField::Resize(int new_size, + const absl::Cord& value); template <> -void RepeatedField::MoveArray(absl::Cord* to, absl::Cord* from, - int size); +PROTOBUF_EXPORT void RepeatedField::MoveArray(absl::Cord* to, + absl::Cord* from, + int size); template <> -void RepeatedField::CopyArray(absl::Cord* to, - const absl::Cord* from, int size); +PROTOBUF_EXPORT void RepeatedField::CopyArray( + absl::Cord* to, const absl::Cord* from, int size); // ------------------------------------------------------------------- @@ -1236,32 +1240,6 @@ internal::RepeatedFieldBackInsertIterator RepeatedFieldBackInserter( return internal::RepeatedFieldBackInsertIterator(mutable_field); } -// Extern declarations of common instantiations to reduce library bloat. -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE - RepeatedField; - -namespace internal { -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedIterator; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE - RepeatedIterator; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE - RepeatedIterator; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE - RepeatedIterator; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE - RepeatedIterator; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedIterator; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedIterator; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE - RepeatedIterator; -} // namespace internal } // namespace protobuf } // namespace google