You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2024/02/20 10:07:02 UTC

(avro) branch main updated: [AVRO-3942] Mark MemoryOutputStream as final (#2752)

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/main by this push:
     new 258571ba8 [AVRO-3942] Mark MemoryOutputStream as final (#2752)
258571ba8 is described below

commit 258571ba84d2e0317b45ac95c1a974e0ee7e7725
Author: Mikhail Koviazin <mi...@aiven.io>
AuthorDate: Tue Feb 20 12:06:56 2024 +0200

    [AVRO-3942] Mark MemoryOutputStream as final (#2752)
    
    Otherwise the class raises a compilation warning:
    
    lang/c++/impl/Stream.cc:129:27: warning: class with destructor marked 'final' cannot be inherited from [-Wfinal-dtor-non-final-class]
      120 | class MemoryOutputStream : public OutputStream {
          |                          final
      121 | public:
      122 |     const size_t chunkSize_;
      123 |     std::vector<uint8_t *> data_;
      124 |     size_t available_;
      125 |     size_t byteCount_;
      126 |
      127 |     explicit MemoryOutputStream(size_t chunkSize) : chunkSize_(chunkSize),
      128 |                                                     available_(0), byteCount_(0) {}
      129 |     ~MemoryOutputStream() final {
          |                           ^
    lang/c++/impl/Stream.cc:120:7: note: mark 'avro::MemoryOutputStream' as 'final' to silence this warning
      120 | class MemoryOutputStream : public OutputStream {
          |       ^
---
 lang/c++/impl/Stream.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lang/c++/impl/Stream.cc b/lang/c++/impl/Stream.cc
index 63a8b4e8f..60524f01d 100644
--- a/lang/c++/impl/Stream.cc
+++ b/lang/c++/impl/Stream.cc
@@ -117,7 +117,7 @@ public:
     }
 };
 
-class MemoryOutputStream : public OutputStream {
+class MemoryOutputStream final : public OutputStream {
 public:
     const size_t chunkSize_;
     std::vector<uint8_t *> data_;