Skip to content

Commit 733f179

Browse files
Fix -Wdeprecated-declarations suppression on Windows
clang on Windows implements GNUC extensions, defines __clang__, but doesn't define __GNUC__, so one needs to handle both __clang__ and __GNUC__ cases. Fix this by using the existing PROTOBUF_IGNORE_DEPRECATION_* macros. This upstreams (an improved version of) one of Chromium's patches: https://source.chromium.org/chromium/chromium/src/+/main:third_party/protobuf/patches/0049-deprecated-declarations-pragma.patch PiperOrigin-RevId: 853514094
1 parent 97c979b commit 733f179

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/google/protobuf/descriptor.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,9 @@ std::string ToJsonName(const absl::string_view input) {
165165

166166
template <typename OptionsT>
167167
bool IsLegacyJsonFieldConflictEnabled(const OptionsT& options) {
168-
#ifdef __GNUC__
169-
#pragma GCC diagnostic push
170-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
171-
#endif
168+
PROTOBUF_IGNORE_DEPRECATION_START
172169
return options.deprecated_legacy_json_field_conflicts();
173-
#ifdef __GNUC__
174-
#pragma GCC diagnostic pop
175-
#endif
170+
PROTOBUF_IGNORE_DEPRECATION_STOP
176171
}
177172

178173
// Backport of fold expressions for the comma operator to C++11.

0 commit comments

Comments
 (0)