From 1cb97c25b15b5671f0b214798c8e76c1458c1052 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Wed, 23 Dec 2020 14:24:41 +0000 Subject: [PATCH] fix: support deprecated enums for GCC < 6 --- src/google/protobuf/port_def.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 01d96070b08a..e6e8a4b463ea 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -165,10 +165,18 @@ } /* namespace protobuf */ \ } /* namespace google */ -#if defined(__GNUC__) || defined(__clang__) +#if defined(__clang__) #define PROTOBUF_DEPRECATED __attribute__((deprecated)) #define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated)) #define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg))) +#elif defined(__GNUC__) +# define PROTOBUF_DEPRECATED __attribute__((deprecated)) +# define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg))) +# if __GNUC__ >= 6 +# define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated)) +# else +# define PROTOBUF_DEPRECATED_ENUM +# endif #elif defined(_MSC_VER) #define PROTOBUF_DEPRECATED __declspec(deprecated) #define PROTOBUF_DEPRECATED_ENUM