Skip to content

Commit 0644388

Browse files
wilstoffcopybara-github
authored andcommitted
Fix missing port_undef (#20052)
unparser.cc, arenaz_sampler_test.cc, and message_module.cc included port_def.inc but forgot to include the undef file. This can cause some issues on which absl macros are defined: In file included from /opt/protobuf-29/include/google/protobuf/arena.h:36: In file included from /opt/protobuf-29/include/google/protobuf/arena_align.h:63: /opt/protobuf-29/include/google/protobuf/port_def.inc:542:5: error: function-like macro 'ABSL_HAVE_FEATURE' is not defined \#if ABSL_HAVE_FEATURE(address_sanitizer) Closes #20052 COPYBARA_INTEGRATE_REVIEW=#20052 from wilstoff:port_undef_fix 861d2e6 PiperOrigin-RevId: 721863566
1 parent d59047a commit 0644388

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

python/google/protobuf/pyext/message_module.cc

+10
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@
44
// Use of this source code is governed by a BSD-style
55
// license that can be found in the LICENSE file or at
66
// https://developers.google.com/open-source/licenses/bsd
7+
#include <cstdint>
8+
#include <string>
79

810
#define PY_SSIZE_T_CLEAN
911
#include <Python.h>
1012

1113
#include "google/protobuf/descriptor.pb.h"
14+
#include "absl/log/absl_check.h"
1215
#include "absl/log/absl_log.h"
16+
#include "absl/status/status.h"
17+
#include "absl/status/statusor.h"
18+
#include "absl/strings/str_cat.h"
19+
#include "google/protobuf/descriptor.h"
20+
#include "google/protobuf/descriptor_database.h"
1321
#include "google/protobuf/dynamic_message.h"
1422
#include "google/protobuf/message_lite.h"
1523
#include "google/protobuf/proto_api.h"
@@ -347,3 +355,5 @@ PyMODINIT_FUNC PyInit__message() {
347355

348356
return m;
349357
}
358+
359+
#include "google/protobuf/port_undef.inc"

src/google/protobuf/arenaz_sampler_test.cc

+11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include "google/protobuf/arenaz_sampler.h"
99

1010
#include <atomic>
11+
#include <cassert>
12+
#include <cstddef>
13+
#include <cstdint>
1114
#include <limits>
1215
#include <memory>
1316
#include <random>
@@ -16,6 +19,12 @@
1619

1720
#include <gmock/gmock.h>
1821
#include <gtest/gtest.h>
22+
#include "absl/log/absl_check.h"
23+
#include "absl/strings/str_cat.h"
24+
#include "absl/synchronization/mutex.h"
25+
#include "absl/time/clock.h"
26+
#include "google/protobuf/arena_allocation_policy.h"
27+
#include "google/protobuf/serial_arena.h"
1928

2029

2130
// Must be included last.
@@ -598,3 +607,5 @@ TEST(ThreadSafeArenazSamplerTest, UsedAndWasted) {
598607
} // namespace internal
599608
} // namespace protobuf
600609
} // namespace google
610+
611+
#include "google/protobuf/port_undef.inc"

src/google/protobuf/json/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,14 @@ cc_library(
266266
"//src/google/protobuf:port",
267267
"//src/google/protobuf:type_cc_proto",
268268
"//src/google/protobuf/io",
269+
"//src/google/protobuf/io:zero_copy_sink",
269270
"//src/google/protobuf/stubs",
270271
"//src/google/protobuf/util:type_resolver",
271272
"@com_google_absl//absl/container:flat_hash_map",
272273
"@com_google_absl//absl/log:absl_check",
273274
"@com_google_absl//absl/log:absl_log",
274275
"@com_google_absl//absl/status",
276+
"@com_google_absl//absl/status:statusor",
275277
"@com_google_absl//absl/strings",
276278
"@com_google_absl//absl/strings:str_format",
277279
"@com_google_absl//absl/types:optional",

src/google/protobuf/json/internal/unparser.cc

+7
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
#include <string>
1919
#include <type_traits>
2020
#include <utility>
21+
#include <vector>
2122

2223
#include "absl/log/absl_check.h"
2324
#include "absl/log/absl_log.h"
2425
#include "absl/status/status.h"
26+
#include "absl/status/statusor.h"
2527
#include "absl/strings/ascii.h"
2628
#include "absl/strings/escaping.h"
2729
#include "absl/strings/str_cat.h"
@@ -31,11 +33,14 @@
3133
#include "google/protobuf/descriptor.h"
3234
#include "google/protobuf/dynamic_message.h"
3335
#include "google/protobuf/io/coded_stream.h"
36+
#include "google/protobuf/io/zero_copy_sink.h"
3437
#include "google/protobuf/io/zero_copy_stream.h"
38+
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
3539
#include "google/protobuf/json/internal/descriptor_traits.h"
3640
#include "google/protobuf/json/internal/unparser_traits.h"
3741
#include "google/protobuf/json/internal/writer.h"
3842
#include "google/protobuf/message.h"
43+
#include "google/protobuf/util/type_resolver.h"
3944
#include "google/protobuf/stubs/status_macros.h"
4045

4146
// Must be included last.
@@ -905,3 +910,5 @@ absl::Status BinaryToJsonStream(google::protobuf::util::TypeResolver* resolver,
905910
} // namespace json_internal
906911
} // namespace protobuf
907912
} // namespace google
913+
914+
#include "google/protobuf/port_undef.inc"

0 commit comments

Comments
 (0)