Skip to content

Commit

Permalink
Fix missing port_undef (#20052)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wilstoff authored and copybara-github committed Jan 31, 2025
1 parent d59047a commit 0644388
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/google/protobuf/pyext/message_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#include <cstdint>
#include <string>

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include "google/protobuf/descriptor.pb.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor_database.h"
#include "google/protobuf/dynamic_message.h"
#include "google/protobuf/message_lite.h"
#include "google/protobuf/proto_api.h"
Expand Down Expand Up @@ -347,3 +355,5 @@ PyMODINIT_FUNC PyInit__message() {

return m;
}

#include "google/protobuf/port_undef.inc"
11 changes: 11 additions & 0 deletions src/google/protobuf/arenaz_sampler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "google/protobuf/arenaz_sampler.h"

#include <atomic>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <memory>
#include <random>
Expand All @@ -16,6 +19,12 @@

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "absl/log/absl_check.h"
#include "absl/strings/str_cat.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/clock.h"
#include "google/protobuf/arena_allocation_policy.h"
#include "google/protobuf/serial_arena.h"


// Must be included last.
Expand Down Expand Up @@ -598,3 +607,5 @@ TEST(ThreadSafeArenazSamplerTest, UsedAndWasted) {
} // namespace internal
} // namespace protobuf
} // namespace google

#include "google/protobuf/port_undef.inc"
2 changes: 2 additions & 0 deletions src/google/protobuf/json/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ cc_library(
"//src/google/protobuf:port",
"//src/google/protobuf:type_cc_proto",
"//src/google/protobuf/io",
"//src/google/protobuf/io:zero_copy_sink",
"//src/google/protobuf/stubs",
"//src/google/protobuf/util:type_resolver",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/types:optional",
Expand Down
7 changes: 7 additions & 0 deletions src/google/protobuf/json/internal/unparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
Expand All @@ -31,11 +33,14 @@
#include "google/protobuf/descriptor.h"
#include "google/protobuf/dynamic_message.h"
#include "google/protobuf/io/coded_stream.h"
#include "google/protobuf/io/zero_copy_sink.h"
#include "google/protobuf/io/zero_copy_stream.h"
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
#include "google/protobuf/json/internal/descriptor_traits.h"
#include "google/protobuf/json/internal/unparser_traits.h"
#include "google/protobuf/json/internal/writer.h"
#include "google/protobuf/message.h"
#include "google/protobuf/util/type_resolver.h"
#include "google/protobuf/stubs/status_macros.h"

// Must be included last.
Expand Down Expand Up @@ -905,3 +910,5 @@ absl::Status BinaryToJsonStream(google::protobuf::util::TypeResolver* resolver,
} // namespace json_internal
} // namespace protobuf
} // namespace google

#include "google/protobuf/port_undef.inc"

0 comments on commit 0644388

Please sign in to comment.