diff --git a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs b/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs deleted file mode 100644 index 208ce1fcb6..0000000000 --- a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs +++ /dev/null @@ -1,17 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd -#endregion - -namespace Google.Protobuf.Reflection; - -internal sealed partial class FeatureSetDescriptor -{ - // Canonical serialized form of the edition defaults, generated by embed_edition_defaults. - private const string DefaultsBase64 = - "ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH"; -} diff --git a/src/google/protobuf/compiler/cpp/file.cc b/src/google/protobuf/compiler/cpp/file.cc index 0391b7bfc3..0d048c8eb1 100644 --- a/src/google/protobuf/compiler/cpp/file.cc +++ b/src/google/protobuf/compiler/cpp/file.cc @@ -855,7 +855,7 @@ void FileGenerator::GenerateStaticInitializer(io::Printer* p) { }}}, R"cc( PROTOBUF_ATTRIBUTE_INIT_PRIORITY$priority$ static ::std::false_type - _static_init$priority$_ PROTOBUF_UNUSED = + _static_init$priority$_ [[maybe_unused]] = ($expr$, ::std::false_type{}); )cc"); // Reset the vector because we might be generating many files. diff --git a/src/google/protobuf/compiler/java/java_features.pb.cc b/src/google/protobuf/compiler/java/java_features.pb.cc index 55e8fbcc16..626fa733f8 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.cc +++ b/src/google/protobuf/compiler/java/java_features.pb.cc @@ -439,7 +439,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fjava_2fjava_5ffeatures_2eproto), ::_pbi::ExtensionSet::RegisterMessageExtension( &::google::protobuf::FeatureSet::default_instance(), 1001, 11, diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 026e233f79..eeac0b235a 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -1830,7 +1830,7 @@ namespace protobuf { } // namespace google // @@protoc_insertion_point(global_scope) PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ PROTOBUF_UNUSED = + _static_init2_ [[maybe_unused]] = (::_pbi::AddDescriptors(&descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto), ::std::false_type{}); #include "google/protobuf/port_undef.inc" diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 81cfcaa7e9..e2bd05f5de 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -4807,7 +4807,7 @@ DescriptorBuilder::DescriptorBuilder( // have to avoid registering these pre-main, because we need to ensure that // the linker --gc-sections step can strip out the full runtime if it is // unused. - PROTOBUF_UNUSED static std::true_type lazy_register = + [[maybe_unused]] static std::true_type lazy_register = (internal::ExtensionSet::RegisterMessageExtension( &FeatureSet::default_instance(), pb::cpp.number(), FieldDescriptor::TYPE_MESSAGE, false, false, diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc index cb8f7e79c9..7c8fbd0043 100644 --- a/src/google/protobuf/generated_message_tctable_lite.cc +++ b/src/google/protobuf/generated_message_tctable_lite.cc @@ -1566,8 +1566,8 @@ void EnsureArenaStringIsNotDefault(const MessageLite* msg, } } // The rest do nothing. -PROTOBUF_UNUSED void EnsureArenaStringIsNotDefault(const MessageLite* msg, - void*) {} +[[maybe_unused]] void EnsureArenaStringIsNotDefault(const MessageLite* msg, + void*) {} } // namespace diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc index 832e3feddb..7f61658da1 100644 --- a/src/google/protobuf/message_unittest.inc +++ b/src/google/protobuf/message_unittest.inc @@ -1572,7 +1572,7 @@ TEST(MESSAGE_TEST_NAME, TestEnumParsers) { constexpr int kInvalidValue = 0x900913; auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_packed : {false, true}) { SCOPED_TRACE(use_packed); for (bool use_tail_field : {false, true}) { @@ -1669,7 +1669,7 @@ TEST(MESSAGE_TEST_NAME, TestEnumParserForUnknownEnumValue) { // For unknown enum values, for consistency we must include the // int32_t enum value in the unknown field set, which might not be exactly the // same as the input. - PROTOBUF_UNUSED auto* descriptor = non_dynamic.descriptor(); + [[maybe_unused]] auto* descriptor = non_dynamic.descriptor(); const std::vector fields = GetFields(); @@ -1722,7 +1722,7 @@ TEST(MESSAGE_TEST_NAME, TestBoolParsers) { GetFields(); auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_tail_field : {false, true}) { SCOPED_TRACE(use_tail_field); for (int non_canonical_bytes = 0; non_canonical_bytes < 10; @@ -1786,7 +1786,7 @@ TEST(MESSAGE_TEST_NAME, TestInt32Parsers) { GetFields(); auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_tail_field : {false, true}) { SCOPED_TRACE(use_tail_field); for (int non_canonical_bytes = 0; non_canonical_bytes < 10; @@ -1851,7 +1851,7 @@ TEST(MESSAGE_TEST_NAME, TestInt64Parsers) { GetFields(); auto* ref = obj.GetReflection(); - PROTOBUF_UNUSED auto* descriptor = obj.descriptor(); + [[maybe_unused]] auto* descriptor = obj.descriptor(); for (bool use_tail_field : {false, true}) { SCOPED_TRACE(use_tail_field); for (int non_canonical_bytes = 0; non_canonical_bytes < 10; @@ -1955,7 +1955,7 @@ TEST(MESSAGE_TEST_NAME, TestRepeatedStringParsers) { "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - PROTOBUF_UNUSED const auto* const descriptor = + [[maybe_unused]] const auto* const descriptor = UNITTEST::StringParseTester::descriptor(); const std::vector fields = diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 90ab4720ef..2eb781cc14 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -598,17 +598,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #define PROTOBUF_TC_PARAM_NO_DATA_PASS \ msg, ptr, ctx, ::google::protobuf::internal::TcFieldData::DefaultInit(), table, hasbits -#ifdef PROTOBUF_UNUSED -#error PROTOBUF_UNUSED was previously defined -#endif -#if ABSL_HAVE_CPP_ATTRIBUTE(maybe_unused) || (PROTOBUF_MSC_VER_MIN(1911)) -#define PROTOBUF_UNUSED [[maybe_unused]] -#elif ABSL_HAVE_ATTRIBUTE(unused) || defined(__GNUC__) -#define PROTOBUF_UNUSED __attribute__((__unused__)) -#else -#define PROTOBUF_UNUSED -#endif - // For the toolchains that support it, evaluates to `true` if the input is // determined to be a compile time constant after optimizations have happened // (like inlining and constant propagation). A `false` result means that the