Merge branch 'main' into utf8_range_dep
diff --git a/src/google/protobuf/io/gzip_stream.h b/src/google/protobuf/io/gzip_stream.h
index eec111c..ba0392b 100644
--- a/src/google/protobuf/io/gzip_stream.h
+++ b/src/google/protobuf/io/gzip_stream.h
@@ -56,8 +56,7 @@
 namespace io {
 
 // A ZeroCopyInputStream that reads compressed data through zlib
-class PROTOBUF_EXPORT GzipInputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyInputStream {
+class PROTOBUF_EXPORT GzipInputStream final : public ZeroCopyInputStream {
  public:
   // Format key for constructor
   enum Format {
@@ -105,8 +104,7 @@
   void DoNextOutput(const void** data, int* size);
 };
 
-class PROTOBUF_EXPORT GzipOutputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyOutputStream {
+class PROTOBUF_EXPORT GzipOutputStream final : public ZeroCopyOutputStream {
  public:
   // Format key for constructor
   enum Format {
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.h b/src/google/protobuf/io/zero_copy_stream_impl.h
index d5a119c..f82a45f 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.h
+++ b/src/google/protobuf/io/zero_copy_stream_impl.h
@@ -62,8 +62,7 @@
 // The latter will introduce an extra layer of buffering, harming performance.
 // Also, it's conceivable that FileInputStream could someday be enhanced
 // to use zero-copy file descriptors on OSs which support them.
-class PROTOBUF_EXPORT FileInputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyInputStream {
+class PROTOBUF_EXPORT FileInputStream final : public ZeroCopyInputStream {
  public:
   // Creates a stream that reads from the given Unix file descriptor.
   // If a block_size is given, it specifies the number of bytes that
@@ -98,7 +97,7 @@
   int64_t ByteCount() const override;
 
  private:
-  class PROTOBUF_EXPORT CopyingFileInputStream PROTOBUF_FUTURE_FINAL
+  class PROTOBUF_EXPORT CopyingFileInputStream final
       : public CopyingInputStream {
    public:
     CopyingFileInputStream(int file_descriptor);
@@ -141,7 +140,7 @@
 // harming performance.  Also, it's conceivable that FileOutputStream could
 // someday be enhanced to use zero-copy file descriptors on OSs which
 // support them.
-class PROTOBUF_EXPORT FileOutputStream PROTOBUF_FUTURE_FINAL
+class PROTOBUF_EXPORT FileOutputStream final
     : public CopyingOutputStreamAdaptor {
  public:
   // Creates a stream that writes to the given Unix file descriptor.
@@ -173,7 +172,7 @@
   int GetErrno() const { return copying_output_.GetErrno(); }
 
  private:
-  class PROTOBUF_EXPORT CopyingFileOutputStream PROTOBUF_FUTURE_FINAL
+  class PROTOBUF_EXPORT CopyingFileOutputStream final
       : public CopyingOutputStream {
    public:
     CopyingFileOutputStream(int file_descriptor);
@@ -207,8 +206,7 @@
 //
 // Note that for reading files (or anything represented by a file descriptor),
 // FileInputStream is more efficient.
-class PROTOBUF_EXPORT IstreamInputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyInputStream {
+class PROTOBUF_EXPORT IstreamInputStream final : public ZeroCopyInputStream {
  public:
   // Creates a stream that reads from the given C++ istream.
   // If a block_size is given, it specifies the number of bytes that
@@ -225,7 +223,7 @@
   int64_t ByteCount() const override;
 
  private:
-  class PROTOBUF_EXPORT CopyingIstreamInputStream PROTOBUF_FUTURE_FINAL
+  class PROTOBUF_EXPORT CopyingIstreamInputStream final
       : public CopyingInputStream {
    public:
     CopyingIstreamInputStream(std::istream* input);
@@ -253,8 +251,7 @@
 //
 // Note that for writing files (or anything represented by a file descriptor),
 // FileOutputStream is more efficient.
-class PROTOBUF_EXPORT OstreamOutputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyOutputStream {
+class PROTOBUF_EXPORT OstreamOutputStream final : public ZeroCopyOutputStream {
  public:
   // Creates a stream that writes to the given C++ ostream.
   // If a block_size is given, it specifies the size of the buffers
@@ -271,7 +268,7 @@
   int64_t ByteCount() const override;
 
  private:
-  class PROTOBUF_EXPORT CopyingOstreamOutputStream PROTOBUF_FUTURE_FINAL
+  class PROTOBUF_EXPORT CopyingOstreamOutputStream final
       : public CopyingOutputStream {
    public:
     CopyingOstreamOutputStream(std::ostream* output);
@@ -301,7 +298,7 @@
 // ConcatenatingInputStream may do odd things.  It is suggested that you do
 // not use ConcatenatingInputStream on streams that might produce read errors
 // other than end-of-stream.
-class PROTOBUF_EXPORT ConcatenatingInputStream PROTOBUF_FUTURE_FINAL
+class PROTOBUF_EXPORT ConcatenatingInputStream final
     : public ZeroCopyInputStream {
  public:
   // All streams passed in as well as the array itself must remain valid
diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
index 3e23514..e51d7cd 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl_lite.h
+++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
@@ -68,8 +68,7 @@
 // ===================================================================
 
 // A ZeroCopyInputStream backed by an in-memory array of bytes.
-class PROTOBUF_EXPORT ArrayInputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyInputStream {
+class PROTOBUF_EXPORT ArrayInputStream final : public ZeroCopyInputStream {
  public:
   // Create an InputStream that returns the bytes pointed to by "data".
   // "data" remains the property of the caller but must remain valid until
@@ -105,8 +104,7 @@
 // ===================================================================
 
 // A ZeroCopyOutputStream backed by an in-memory array of bytes.
-class PROTOBUF_EXPORT ArrayOutputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyOutputStream {
+class PROTOBUF_EXPORT ArrayOutputStream final : public ZeroCopyOutputStream {
  public:
   // Create an OutputStream that writes to the bytes pointed to by "data".
   // "data" remains the property of the caller but must remain valid until
@@ -140,8 +138,7 @@
 // ===================================================================
 
 // A ZeroCopyOutputStream which appends bytes to a string.
-class PROTOBUF_EXPORT StringOutputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyOutputStream {
+class PROTOBUF_EXPORT StringOutputStream final : public ZeroCopyOutputStream {
  public:
   // Create a StringOutputStream which appends bytes to the given string.
   // The string remains property of the caller, but it is mutated in arbitrary
@@ -364,8 +361,7 @@
 
 // A ZeroCopyInputStream which wraps some other stream and limits it to
 // a particular byte count.
-class PROTOBUF_EXPORT LimitingInputStream PROTOBUF_FUTURE_FINAL
-    : public ZeroCopyInputStream {
+class PROTOBUF_EXPORT LimitingInputStream final : public ZeroCopyInputStream {
  public:
   LimitingInputStream(ZeroCopyInputStream* input, int64_t limit);
   ~LimitingInputStream() override;
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index fa4416b..6a546aa 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -208,11 +208,6 @@
 // Owner: mordberg@
 #define PROTOBUF_FUTURE_MAP_PAIR_UPGRADE 1
 
-// Used on classes that are historically not marked as final, but that may be
-// marked final in future (breaking) releases.
-// Owner: kfm@
-#define PROTOBUF_FUTURE_FINAL final
-
 // Used to remove the RTTI checks for `DefaultFieldComparator`.
 // Owner: kfm@
 #define PROTOBUF_FUTURE_REMOVE_DEFAULT_FIELD_COMPARATOR 1
@@ -221,8 +216,6 @@
 // Owner: mkruskal@
 #define PROTOBUF_FUTURE_REMOVE_CLEARED_API 1
 
-#else
-#define PROTOBUF_FUTURE_FINAL
 #endif
 
 #ifdef PROTOBUF_VERSION
diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc
index 5788116..b731d65 100644
--- a/src/google/protobuf/port_undef.inc
+++ b/src/google/protobuf/port_undef.inc
@@ -88,7 +88,6 @@
 #undef PROTOBUF_EXPORT_TEMPLATE_DEFINE
 #undef PROTOBUF_ALIGNAS
 #undef PROTOBUF_FINAL
-#undef PROTOBUF_FUTURE_FINAL
 #undef PROTOBUF_THREAD_LOCAL
 #undef PROTOBUF_LITTLE_ENDIAN
 #undef PROTOBUF_BIG_ENDIAN
@@ -123,8 +122,6 @@
 #undef PROTOBUF_FUTURE_REMOVE_CLEARED_API
 #endif
 
-#undef PROTOBUF_FUTURE_FINAL
-
 // Restore macros that may have been #undef'd in port_def.inc.
 
 #ifdef PROTOBUF_DID_UNDEF_PACKAGE
diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h
index 9d4cc2c..2c7f967 100644
--- a/src/google/protobuf/repeated_ptr_field.h
+++ b/src/google/protobuf/repeated_ptr_field.h
@@ -1160,8 +1160,9 @@
   //
   // This method cannot be called when the repeated field is on an arena; doing
   // so will trigger a GOOGLE_ABSL_DCHECK-failure.
+  PROTOBUF_NODISCARD
   ABSL_DEPRECATED("This will be removed in a future release")
-  PROTOBUF_NODISCARD Element* ReleaseCleared();
+  Element* ReleaseCleared();
 #endif  // !PROTOBUF_FUTURE_REMOVE_CLEARED_API
 
   // Removes the element referenced by position.
diff --git a/src/google/protobuf/util/field_comparator.h b/src/google/protobuf/util/field_comparator.h
index 392bc99..b5a5ba8 100644
--- a/src/google/protobuf/util/field_comparator.h
+++ b/src/google/protobuf/util/field_comparator.h
@@ -258,7 +258,7 @@
 };
 
 // Default field comparison: use the basic implementation of FieldComparator.
-class PROTOBUF_EXPORT DefaultFieldComparator PROTOBUF_FUTURE_FINAL
+class PROTOBUF_EXPORT DefaultFieldComparator final
     : public SimpleFieldComparator {
  public:
   ComparisonResult Compare(const Message& message_1, const Message& message_2,
diff --git a/update_subtrees.sh b/update_subtrees.sh
old mode 100755
new mode 100644
index 225de5f..df75ba3
--- a/update_subtrees.sh
+++ b/update_subtrees.sh
@@ -2,7 +2,7 @@
 
 set -eux
 
-cd $(dirname $0)/..
+cd $(dirname $0)
 
 git subtree pull --prefix third_party/utf8_range \
   https://github.com/protocolbuffers/utf8_range.git main --squash