1diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc 2index bdb2eecbe2e47..8bd06d340f7c3 100644 3--- a/src/google/protobuf/port_def.inc 4+++ b/src/google/protobuf/port_def.inc 5@@ -313,7 +313,10 @@ 6 #if defined(PROTOBUF_DEPRECATED_MSG) 7 #error PROTOBUF_DEPRECATED_MSG was previously defined 8 #endif 9-#if __has_attribute(deprecated) || PROTOBUF_GNUC_MIN(3, 0) 10+#if defined(PROTOBUF_ALLOW_DEPRECATED) 11+# define PROTOBUF_DEPRECATED 12+# define PROTOBUF_DEPRECATED_MSG(msg) 13+#elif __has_attribute(deprecated) || PROTOBUF_GNUC_MIN(3, 0) 14 # define PROTOBUF_DEPRECATED __attribute__((deprecated)) 15 # define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg))) 16 #elif defined(_MSC_VER) 17@@ -327,7 +330,9 @@ 18 #if defined(PROTOBUF_DEPRECATED_ENUM) 19 #error PROTOBUF_DEPRECATED_ENUM was previously defined 20 #endif 21-#if defined(__clang__) || PROTOBUF_GNUC_MIN(6, 0) 22+#if defined(PROTOBUF_ALLOW_DEPRECATED) 23+# define PROTOBUF_DEPRECATED_ENUM 24+#elif defined(__clang__) || PROTOBUF_GNUC_MIN(6, 0) 25 // https://gcc.gnu.org/gcc-6/changes.html 26 # define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated)) 27 #else 28