Skip to content

Commit

Permalink
Updated deprecation macros to annotate deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
acozzette committed Sep 30, 2019
1 parent 0d1d92d commit 4ed83cb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions BUILD
Expand Up @@ -59,6 +59,7 @@ COPTS = select({
"-Wno-unused-function",
# Prevents ISO C++ const string assignment warnings for pyext sources.
"-Wno-write-strings",
"-Wno-deprecated-declarations",
],
})

Expand Down
1 change: 1 addition & 0 deletions src/google/protobuf/dynamic_message.h
Expand Up @@ -44,6 +44,7 @@

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/message.h>
#include <google/protobuf/reflection.h>
#include <google/protobuf/stubs/mutex.h>
#include <google/protobuf/reflection.h>
#include <google/protobuf/repeated_field.h>
Expand Down
11 changes: 9 additions & 2 deletions src/google/protobuf/port_def.inc
Expand Up @@ -146,8 +146,15 @@
#define PROTOBUF_NAMESPACE_CLOSE \
} /* namespace protobuf */ \
} /* namespace google */
#define PROTOBUF_DEPRECATED
#define PROTOBUF_DEPRECATED_MSG(x)

#if defined(__GNUC__) || defined(__clang__)
#define PROTOBUF_DEPRECATED __attribute__((deprecated))
#define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
#elif defined(_MSC_VER)
#define PROTOBUF_DEPRECATED __declspec(deprecated)
#define PROTOBUF_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
#endif

#define PROTOBUF_SECTION_VARIABLE(x)
#define PROTOBUF_MUST_USE_RESULT

Expand Down
5 changes: 3 additions & 2 deletions src/google/protobuf/stubs/port.h
Expand Up @@ -103,8 +103,9 @@
#define LIBPROTOC_EXPORT
#endif

#define PROTOBUF_RUNTIME_DEPRECATED(message)
#define GOOGLE_PROTOBUF_RUNTIME_DEPRECATED(message)
#define PROTOBUF_RUNTIME_DEPRECATED(message) PROTOBUF_DEPRECATED_MSG(message)
#define GOOGLE_PROTOBUF_RUNTIME_DEPRECATED(message) \
PROTOBUF_DEPRECATED_MSG(message)

// ===================================================================
// from google3/base/port.h
Expand Down
1 change: 1 addition & 0 deletions src/google/protobuf/text_format.h
Expand Up @@ -157,6 +157,7 @@ class PROTOBUF_EXPORT TextFormat {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FastFieldValuePrinter);
};

// Deprecated: please use FastFieldValuePrinter instead.
class PROTOBUF_EXPORT FieldValuePrinter {
public:
FieldValuePrinter();
Expand Down

0 comments on commit 4ed83cb

Please sign in to comment.