Use PROTOBUF_DEPRECATED instead of PROTOBUF_DEPRECATED_ENUM

pull/12026/head
Yuriy Chernyshov 2 years ago
parent b4370b2e76
commit 536c3c9ff7
  1. 4
      src/google/protobuf/compiler/cpp/enum.cc
  2. 2
      src/google/protobuf/compiler/cpp/helpers.h
  3. 10
      src/google/protobuf/port_def.inc
  4. 1
      src/google/protobuf/port_undef.inc

@ -143,7 +143,7 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) {
.AnnotatedAs(value),
{"kNumber", Int32ToString(value->number())},
{"DEPRECATED", value->options().deprecated()
? "PROTOBUF_DEPRECATED_ENUM"
? "PROTOBUF_DEPRECATED"
: ""},
},
R"cc(
@ -302,7 +302,7 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* p) const {
{
Sub("VALUE", EnumValueName(enum_->value(j))).AnnotatedAs(value),
{"DEPRECATED",
value->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM" : ""},
value->options().deprecated() ? "PROTOBUF_DEPRECATED" : ""},
},
R"cc(
$DEPRECATED $static constexpr $Enum_$ $VALUE$ = $Msg_Enum$_$VALUE$;

@ -82,7 +82,7 @@ inline std::string DeprecatedAttribute(const Options& /* options */,
inline std::string DeprecatedAttribute(const Options& /* options */,
const EnumValueDescriptor* d) {
return d->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM " : "";
return d->options().deprecated() ? "PROTOBUF_DEPRECATED " : "";
}
// Commonly-used separator comments. Thick is a line of '=', thin is a line

@ -386,16 +386,6 @@ static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and
# define PROTOBUF_DEPRECATED_MSG(msg)
#endif
#if defined(PROTOBUF_DEPRECATED_ENUM)
#error PROTOBUF_DEPRECATED_ENUM was previously defined
#endif
#if defined(__clang__) || defined(__GNUC__)
// https://gcc.gnu.org/gcc-6/changes.html
# define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated))
#else
# define PROTOBUF_DEPRECATED_ENUM
#endif
#if defined(__clang__)
#define PROTOBUF_IGNORE_DEPRECATION_START \
_Pragma("clang diagnostic push") \

@ -56,7 +56,6 @@
#undef PROTOBUF_NOINLINE
#undef PROTOBUF_SECTION_VARIABLE
#undef PROTOBUF_DEPRECATED
#undef PROTOBUF_DEPRECATED_ENUM
#undef PROTOBUF_DEPRECATED_MSG
#undef PROTOBUF_IGNORE_DEPRECATION_START
#undef PROTOBUF_IGNORE_DEPRECATION_STOP

Loading…
Cancel
Save