Skip to content

Commit 54d9f6a

Browse files
coryanAdam Cozzette
authored andcommitted
fix: support deprecated enums for GCC < 6
1 parent 36aff6a commit 54d9f6a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/google/protobuf/port_def.inc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,18 @@
165165
} /* namespace protobuf */ \
166166
} /* namespace google */
167167

168-
#if defined(__GNUC__) || defined(__clang__)
168+
#if defined(__clang__)
169169
#define PROTOBUF_DEPRECATED __attribute__((deprecated))
170170
#define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated))
171171
#define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
172+
#elif defined(__GNUC__)
173+
# define PROTOBUF_DEPRECATED __attribute__((deprecated))
174+
# define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
175+
# if __GNUC__ >= 6
176+
# define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated))
177+
# else
178+
# define PROTOBUF_DEPRECATED_ENUM
179+
# endif
172180
#elif defined(_MSC_VER)
173181
#define PROTOBUF_DEPRECATED __declspec(deprecated)
174182
#define PROTOBUF_DEPRECATED_ENUM

0 commit comments

Comments
 (0)