diff options
author | amistry <amistry@chromium.org> | 2016-03-02 16:26:11 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-03 00:27:32 +0000 |
commit | 432564c6ecff52ab735bdc35adcf537d89b13589 (patch) | |
tree | bf35938fa14739903da55a1369a7a96d223a335b /mojo/public | |
parent | b9dd98ce23a6dab545c18a21eca0783f4597b081 (diff) | |
download | chromium_src-432564c6ecff52ab735bdc35adcf537d89b13589.zip chromium_src-432564c6ecff52ab735bdc35adcf537d89b13589.tar.gz chromium_src-432564c6ecff52ab735bdc35adcf537d89b13589.tar.bz2 |
Remove MOJO_DISALLOW_COPY_AND_ASSIGN and MOJO_ALLOW_UNUSED_LOCAL.
BUG=534695
Review URL: https://codereview.chromium.org/1755003002
Cr-Commit-Position: refs/heads/master@{#378891}
Diffstat (limited to 'mojo/public')
47 files changed, 99 insertions, 121 deletions
diff --git a/mojo/public/c/system/macros.h b/mojo/public/c/system/macros.h index 7f28e18..26f5982 100644 --- a/mojo/public/c/system/macros.h +++ b/mojo/public/c/system/macros.h @@ -7,12 +7,6 @@ #include <stddef.h> -// Annotate a variable indicating it's okay if it's unused. -// Use like: -// int x = ...; -// MOJO_ALLOW_UNUSED_LOCAL(x); -#define MOJO_ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 - // Annotate a function indicating that the caller must examine the return value. // Use like: // int foo() MOJO_WARN_UNUSED_RESULT; diff --git a/mojo/public/c/system/tests/core_perftest.cc b/mojo/public/c/system/tests/core_perftest.cc index 3ee3015..dc5566e 100644 --- a/mojo/public/c/system/tests/core_perftest.cc +++ b/mojo/public/c/system/tests/core_perftest.cc @@ -59,7 +59,7 @@ class MessagePipeWriterThread : public mojo::Thread { const uint32_t num_bytes_; int64_t num_writes_; - MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeWriterThread); + DISALLOW_COPY_AND_ASSIGN(MessagePipeWriterThread); }; class MessagePipeReaderThread : public mojo::Thread { @@ -104,7 +104,7 @@ class MessagePipeReaderThread : public mojo::Thread { const MojoHandle handle_; int64_t num_reads_; - MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeReaderThread); + DISALLOW_COPY_AND_ASSIGN(MessagePipeReaderThread); }; #endif // !defined(WIN32) @@ -118,7 +118,7 @@ class CorePerftest : public testing::Test { static void MessagePipe_CreateAndClose(void* closure) { CorePerftest* self = static_cast<CorePerftest*>(closure); MojoResult result = MojoCreateMessagePipe(nullptr, &self->h0_, &self->h1_); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); result = MojoClose(self->h0_); assert(result == MOJO_RESULT_OK); @@ -131,7 +131,7 @@ class CorePerftest : public testing::Test { MojoResult result = MojoWriteMessage(self->h0_, self->buffer_, self->num_bytes_, nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); uint32_t read_bytes = self->num_bytes_; result = MojoReadMessage(self->h1_, self->buffer_, &read_bytes, nullptr, @@ -144,7 +144,7 @@ class CorePerftest : public testing::Test { MojoResult result = MojoReadMessage(self->h0_, nullptr, nullptr, nullptr, nullptr, MOJO_READ_MESSAGE_FLAG_MAY_DISCARD); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_SHOULD_WAIT); } @@ -159,7 +159,7 @@ class CorePerftest : public testing::Test { assert(num_readers > 0); MojoResult result = MojoCreateMessagePipe(nullptr, &h0_, &h1_); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); std::vector<MessagePipeWriterThread*> writers; @@ -240,12 +240,12 @@ class CorePerftest : public testing::Test { static_cast<long>(microseconds % 1000000) * 1000L // Nanoseconds. }; int rv = nanosleep(&req, nullptr); - MOJO_ALLOW_UNUSED_LOCAL(rv); + ALLOW_UNUSED_LOCAL(rv); assert(rv == 0); } #endif // !defined(WIN32) - MOJO_DISALLOW_COPY_AND_ASSIGN(CorePerftest); + DISALLOW_COPY_AND_ASSIGN(CorePerftest); }; // A no-op test so we can compare performance. @@ -262,7 +262,7 @@ TEST_F(CorePerftest, MessagePipe_CreateAndClose) { TEST_F(CorePerftest, MessagePipe_WriteAndRead) { MojoResult result = MojoCreateMessagePipe(nullptr, &h0_, &h1_); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); char buffer[10000] = {0}; buffer_ = buffer; @@ -290,7 +290,7 @@ TEST_F(CorePerftest, MessagePipe_WriteAndRead) { TEST_F(CorePerftest, MessagePipe_EmptyRead) { MojoResult result = MojoCreateMessagePipe(nullptr, &h0_, &h1_); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); mojo::test::IterateAndReportPerf("MessagePipe_EmptyRead", nullptr, &CorePerftest::MessagePipe_EmptyRead, this); diff --git a/mojo/public/c/system/tests/macros_unittest.cc b/mojo/public/c/system/tests/macros_unittest.cc index b22e124..19fcb54 100644 --- a/mojo/public/c/system/tests/macros_unittest.cc +++ b/mojo/public/c/system/tests/macros_unittest.cc @@ -19,12 +19,6 @@ namespace mojo { namespace { -TEST(MacrosTest, AllowUnused) { - // Test that no warning/error is issued even though |x| is unused. - int x = 123; - MOJO_ALLOW_UNUSED_LOCAL(x); -} - int MustUseReturnedResult() MOJO_WARN_UNUSED_RESULT; int MustUseReturnedResult() { return 456; diff --git a/mojo/public/cpp/bindings/lib/bounds_checker.h b/mojo/public/cpp/bindings/lib/bounds_checker.h index 1d0f00e..aac3b665 100644 --- a/mojo/public/cpp/bindings/lib/bounds_checker.h +++ b/mojo/public/cpp/bindings/lib/bounds_checker.h @@ -8,7 +8,7 @@ #include <stddef.h> #include <stdint.h> -#include "mojo/public/cpp/system/macros.h" +#include "base/macros.h" namespace mojo { @@ -55,7 +55,7 @@ class BoundsChecker { uint32_t handle_begin_; uint32_t handle_end_; - MOJO_DISALLOW_COPY_AND_ASSIGN(BoundsChecker); + DISALLOW_COPY_AND_ASSIGN(BoundsChecker); }; } // namespace internal diff --git a/mojo/public/cpp/bindings/lib/connector.h b/mojo/public/cpp/bindings/lib/connector.h index 2195be2..7c508b0 100644 --- a/mojo/public/cpp/bindings/lib/connector.h +++ b/mojo/public/cpp/bindings/lib/connector.h @@ -194,7 +194,7 @@ class Connector : public MessageReceiver { base::WeakPtrFactory<Connector> weak_factory_; - MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); + DISALLOW_COPY_AND_ASSIGN(Connector); }; } // namespace internal diff --git a/mojo/public/cpp/bindings/lib/control_message_handler.cc b/mojo/public/cpp/bindings/lib/control_message_handler.cc index 565104c..1316b6d 100644 --- a/mojo/public/cpp/bindings/lib/control_message_handler.cc +++ b/mojo/public/cpp/bindings/lib/control_message_handler.cc @@ -64,7 +64,7 @@ bool ControlMessageHandler::Run(Message* message, response_params->EncodePointersAndHandles( builder.message()->mutable_handles()); bool ok = responder->Accept(builder.message()); - MOJO_ALLOW_UNUSED_LOCAL(ok); + ALLOW_UNUSED_LOCAL(ok); delete responder; return true; diff --git a/mojo/public/cpp/bindings/lib/control_message_handler.h b/mojo/public/cpp/bindings/lib/control_message_handler.h index 4a2fed5..225dfec 100644 --- a/mojo/public/cpp/bindings/lib/control_message_handler.h +++ b/mojo/public/cpp/bindings/lib/control_message_handler.h @@ -33,7 +33,7 @@ class ControlMessageHandler : public MessageReceiverWithResponderStatus { uint32_t interface_version_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ControlMessageHandler); + DISALLOW_COPY_AND_ASSIGN(ControlMessageHandler); }; } // namespace internal diff --git a/mojo/public/cpp/bindings/lib/control_message_proxy.cc b/mojo/public/cpp/bindings/lib/control_message_proxy.cc index 6c5daa9..d450355 100644 --- a/mojo/public/cpp/bindings/lib/control_message_proxy.cc +++ b/mojo/public/cpp/bindings/lib/control_message_proxy.cc @@ -28,7 +28,7 @@ class RunResponseForwardToCallback : public MessageReceiver { private: RunCallback callback_; - MOJO_DISALLOW_COPY_AND_ASSIGN(RunResponseForwardToCallback); + DISALLOW_COPY_AND_ASSIGN(RunResponseForwardToCallback); }; bool RunResponseForwardToCallback::Accept(Message* message) { @@ -77,7 +77,7 @@ void SendRunOrClosePipeMessage(MessageReceiverWithResponder* receiver, Serialize_(std::move(params_ptr), builder.buffer(), ¶ms, nullptr); params->EncodePointersAndHandles(builder.message()->mutable_handles()); bool ok = receiver->Accept(builder.message()); - MOJO_ALLOW_UNUSED_LOCAL(ok); + ALLOW_UNUSED_LOCAL(ok); } } // namespace diff --git a/mojo/public/cpp/bindings/lib/control_message_proxy.h b/mojo/public/cpp/bindings/lib/control_message_proxy.h index 5b0f018..57b871e 100644 --- a/mojo/public/cpp/bindings/lib/control_message_proxy.h +++ b/mojo/public/cpp/bindings/lib/control_message_proxy.h @@ -29,7 +29,7 @@ class ControlMessageProxy { // Not owned. MessageReceiverWithResponder* receiver_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ControlMessageProxy); + DISALLOW_COPY_AND_ASSIGN(ControlMessageProxy); }; } // namespace internal diff --git a/mojo/public/cpp/bindings/lib/fixed_buffer.h b/mojo/public/cpp/bindings/lib/fixed_buffer.h index 5f5f746..d087c3b 100644 --- a/mojo/public/cpp/bindings/lib/fixed_buffer.h +++ b/mojo/public/cpp/bindings/lib/fixed_buffer.h @@ -7,8 +7,8 @@ #include <stddef.h> +#include "base/macros.h" #include "mojo/public/cpp/bindings/lib/buffer.h" -#include "mojo/public/cpp/system/macros.h" namespace mojo { namespace internal { @@ -58,7 +58,7 @@ class FixedBuffer : public Buffer { size_t cursor_; size_t size_; - MOJO_DISALLOW_COPY_AND_ASSIGN(FixedBuffer); + DISALLOW_COPY_AND_ASSIGN(FixedBuffer); }; class FixedBufferForTesting : public FixedBuffer { @@ -73,7 +73,7 @@ class FixedBufferForTesting : public FixedBuffer { void* Leak(); private: - MOJO_DISALLOW_COPY_AND_ASSIGN(FixedBufferForTesting); + DISALLOW_COPY_AND_ASSIGN(FixedBufferForTesting); }; } // namespace internal diff --git a/mojo/public/cpp/bindings/lib/message_builder.h b/mojo/public/cpp/bindings/lib/message_builder.h index e728492..19eeeda 100644 --- a/mojo/public/cpp/bindings/lib/message_builder.h +++ b/mojo/public/cpp/bindings/lib/message_builder.h @@ -30,7 +30,7 @@ class MessageBuilder { Message message_; - MOJO_DISALLOW_COPY_AND_ASSIGN(MessageBuilder); + DISALLOW_COPY_AND_ASSIGN(MessageBuilder); }; class MessageWithRequestIDBuilder : public MessageBuilder { diff --git a/mojo/public/cpp/bindings/lib/shared_data.h b/mojo/public/cpp/bindings/lib/shared_data.h index 6803a5c..0028e11 100644 --- a/mojo/public/cpp/bindings/lib/shared_data.h +++ b/mojo/public/cpp/bindings/lib/shared_data.h @@ -7,6 +7,7 @@ #include <assert.h> +#include "base/macros.h" #include "base/threading/thread_checker.h" #include "mojo/public/cpp/system/macros.h" @@ -96,7 +97,7 @@ class SharedData { private: int ref_count_; base::ThreadChecker thread_checker_; - MOJO_DISALLOW_COPY_AND_ASSIGN(Holder); + DISALLOW_COPY_AND_ASSIGN(Holder); }; void LazyInit() const { diff --git a/mojo/public/cpp/bindings/lib/shared_ptr.h b/mojo/public/cpp/bindings/lib/shared_ptr.h index 37c8735..0855b2e 100644 --- a/mojo/public/cpp/bindings/lib/shared_ptr.h +++ b/mojo/public/cpp/bindings/lib/shared_ptr.h @@ -5,6 +5,7 @@ #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_ #define MOJO_PUBLIC_CPP_BINDINGS_LIB_SHARED_PTR_H_ +#include "base/macros.h" #include "mojo/public/cpp/bindings/lib/shared_data.h" namespace mojo { @@ -45,7 +46,7 @@ class SharedPtr { P* ptr; private: - MOJO_DISALLOW_COPY_AND_ASSIGN(Impl); + DISALLOW_COPY_AND_ASSIGN(Impl); }; SharedData<Impl> impl_; diff --git a/mojo/public/cpp/bindings/lib/validate_params.h b/mojo/public/cpp/bindings/lib/validate_params.h index 9f6d3b38..4f4735a 100644 --- a/mojo/public/cpp/bindings/lib/validate_params.h +++ b/mojo/public/cpp/bindings/lib/validate_params.h @@ -42,7 +42,7 @@ class ArrayValidateParams { ArrayValidateParams* element_validate_params; private: - MOJO_DISALLOW_COPY_AND_ASSIGN(ArrayValidateParams); + DISALLOW_COPY_AND_ASSIGN(ArrayValidateParams); }; } // namespace internal diff --git a/mojo/public/cpp/bindings/lib/validation_errors.h b/mojo/public/cpp/bindings/lib/validation_errors.h index 163b305..1fcd335 100644 --- a/mojo/public/cpp/bindings/lib/validation_errors.h +++ b/mojo/public/cpp/bindings/lib/validation_errors.h @@ -87,7 +87,7 @@ class ValidationErrorObserverForTesting { ValidationError last_error_; Callback<void()> callback_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ValidationErrorObserverForTesting); + DISALLOW_COPY_AND_ASSIGN(ValidationErrorObserverForTesting); }; // Used only by MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING. Don't use it directly. @@ -109,7 +109,7 @@ class SerializationWarningObserverForTesting { private: ValidationError last_warning_; - MOJO_DISALLOW_COPY_AND_ASSIGN(SerializationWarningObserverForTesting); + DISALLOW_COPY_AND_ASSIGN(SerializationWarningObserverForTesting); }; } // namespace internal diff --git a/mojo/public/cpp/bindings/message.h b/mojo/public/cpp/bindings/message.h index 9781a13..9834e7e 100644 --- a/mojo/public/cpp/bindings/message.h +++ b/mojo/public/cpp/bindings/message.h @@ -96,7 +96,7 @@ class Message { scoped_ptr<internal::PickleBuffer> buffer_; std::vector<Handle> handles_; - MOJO_DISALLOW_COPY_AND_ASSIGN(Message); + DISALLOW_COPY_AND_ASSIGN(Message); }; class MessageReceiver { diff --git a/mojo/public/cpp/bindings/tests/binding_unittest.cc b/mojo/public/cpp/bindings/tests/binding_unittest.cc index 1949c21..6e8e578 100644 --- a/mojo/public/cpp/bindings/tests/binding_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_unittest.cc @@ -32,7 +32,7 @@ class BindingTestBase : public testing::Test { private: base::MessageLoop loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(BindingTestBase); + DISALLOW_COPY_AND_ASSIGN(BindingTestBase); }; class ServiceImpl : public sample::Service { @@ -56,7 +56,7 @@ class ServiceImpl : public sample::Service { bool* const was_deleted_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceImpl); + DISALLOW_COPY_AND_ASSIGN(ServiceImpl); }; // BindingTest ----------------------------------------------------------------- @@ -181,7 +181,7 @@ class ServiceImplWithBinding : public ServiceImpl { Binding<sample::Service> binding_; base::Closure closure_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceImplWithBinding); + DISALLOW_COPY_AND_ASSIGN(ServiceImplWithBinding); }; // Tests that the binding may be deleted in the connection error handler. @@ -251,7 +251,7 @@ class IntegerAccessorImpl : public sample::IntegerAccessor { } void SetInteger(int64_t data, sample::Enum type) override {} - MOJO_DISALLOW_COPY_AND_ASSIGN(IntegerAccessorImpl); + DISALLOW_COPY_AND_ASSIGN(IntegerAccessorImpl); }; TEST_F(BindingTest, SetInterfacePtrVersion) { @@ -362,7 +362,7 @@ class ServiceImplWithStrongBinding : public ServiceImpl { private: StrongBinding<sample::Service> binding_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceImplWithStrongBinding); + DISALLOW_COPY_AND_ASSIGN(ServiceImplWithStrongBinding); }; // Tests the typical case, where the implementation object owns the diff --git a/mojo/public/cpp/bindings/tests/bindings_perftest.cc b/mojo/public/cpp/bindings/tests/bindings_perftest.cc index 87337cd..8162f81 100644 --- a/mojo/public/cpp/bindings/tests/bindings_perftest.cc +++ b/mojo/public/cpp/bindings/tests/bindings_perftest.cc @@ -32,7 +32,7 @@ class PingServiceImpl : public test::PingService { void Ping(const Callback<void()>& callback) override; private: - MOJO_DISALLOW_COPY_AND_ASSIGN(PingServiceImpl); + DISALLOW_COPY_AND_ASSIGN(PingServiceImpl); }; void PingServiceImpl::Ping(const Callback<void()>& callback) { @@ -52,7 +52,7 @@ class PingPongTest { unsigned int iterations_to_run_; unsigned int current_iterations_; - MOJO_DISALLOW_COPY_AND_ASSIGN(PingPongTest); + DISALLOW_COPY_AND_ASSIGN(PingPongTest); }; PingPongTest::PingPongTest(test::PingServicePtr service) diff --git a/mojo/public/cpp/bindings/tests/equals_unittest.cc b/mojo/public/cpp/bindings/tests/equals_unittest.cc index 5c460d2..37b25ca 100644 --- a/mojo/public/cpp/bindings/tests/equals_unittest.cc +++ b/mojo/public/cpp/bindings/tests/equals_unittest.cc @@ -123,13 +123,13 @@ TEST_F(EqualsTest, InterfacePtr) { EXPECT_TRUE(InterfaceValueTraits::Equals(inf1, inf2)); auto inf1_request = GetProxy(&inf1); - MOJO_ALLOW_UNUSED_LOCAL(inf1_request); + ALLOW_UNUSED_LOCAL(inf1_request); EXPECT_TRUE(InterfaceValueTraits::Equals(inf1, inf1)); EXPECT_FALSE(InterfaceValueTraits::Equals(inf1, inf2)); auto inf2_request = GetProxy(&inf2); - MOJO_ALLOW_UNUSED_LOCAL(inf2_request); + ALLOW_UNUSED_LOCAL(inf2_request); EXPECT_FALSE(InterfaceValueTraits::Equals(inf1, inf2)); } diff --git a/mojo/public/cpp/bindings/tests/message_queue.h b/mojo/public/cpp/bindings/tests/message_queue.h index 823758d..8859869 100644 --- a/mojo/public/cpp/bindings/tests/message_queue.h +++ b/mojo/public/cpp/bindings/tests/message_queue.h @@ -7,7 +7,7 @@ #include <queue> -#include "mojo/public/cpp/system/macros.h" +#include "base/macros.h" namespace mojo { class Message; @@ -36,7 +36,7 @@ class MessageQueue { std::queue<Message*> queue_; - MOJO_DISALLOW_COPY_AND_ASSIGN(MessageQueue); + DISALLOW_COPY_AND_ASSIGN(MessageQueue); }; } // namespace test diff --git a/mojo/public/cpp/bindings/tests/versioning_apptest.cc b/mojo/public/cpp/bindings/tests/versioning_apptest.cc index 6b6a3f3..e3d63e1 100644 --- a/mojo/public/cpp/bindings/tests/versioning_apptest.cc +++ b/mojo/public/cpp/bindings/tests/versioning_apptest.cc @@ -30,7 +30,7 @@ class VersioningApplicationTest : public ApplicationTestBase { HumanResourceDatabasePtr database_; private: - MOJO_DISALLOW_COPY_AND_ASSIGN(VersioningApplicationTest); + DISALLOW_COPY_AND_ASSIGN(VersioningApplicationTest); }; TEST_F(VersioningApplicationTest, Struct) { diff --git a/mojo/public/cpp/bindings/tests/versioning_test_service.cc b/mojo/public/cpp/bindings/tests/versioning_test_service.cc index 8e04c0a..7d4b3c0 100644 --- a/mojo/public/cpp/bindings/tests/versioning_test_service.cc +++ b/mojo/public/cpp/bindings/tests/versioning_test_service.cc @@ -26,7 +26,7 @@ struct EmployeeInfo { Array<uint8_t> finger_print; private: - MOJO_DISALLOW_COPY_AND_ASSIGN(EmployeeInfo); + DISALLOW_COPY_AND_ASSIGN(EmployeeInfo); }; class HumanResourceDatabaseImpl : public HumanResourceDatabase { diff --git a/mojo/public/cpp/environment/async_waiter.h b/mojo/public/cpp/environment/async_waiter.h index 83b7c8a..afb4ad1 100644 --- a/mojo/public/cpp/environment/async_waiter.h +++ b/mojo/public/cpp/environment/async_waiter.h @@ -32,7 +32,7 @@ class AsyncWaiter { MojoAsyncWaitID id_; const Callback callback_; - MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiter); + DISALLOW_COPY_AND_ASSIGN(AsyncWaiter); }; } // namespace mojo diff --git a/mojo/public/cpp/environment/environment.h b/mojo/public/cpp/environment/environment.h index 3a54428..4cfb963 100644 --- a/mojo/public/cpp/environment/environment.h +++ b/mojo/public/cpp/environment/environment.h @@ -5,7 +5,7 @@ #ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ #define MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ -#include "mojo/public/cpp/system/macros.h" +#include "base/macros.h" struct MojoAsyncWaiter; struct MojoLogger; @@ -45,7 +45,7 @@ class Environment { static void DestroyDefaultRunLoop(); private: - MOJO_DISALLOW_COPY_AND_ASSIGN(Environment); + DISALLOW_COPY_AND_ASSIGN(Environment); }; } // namespace mojo diff --git a/mojo/public/cpp/environment/lib/default_async_waiter.cc b/mojo/public/cpp/environment/lib/default_async_waiter.cc index 4a588a9..9d9b07e 100644 --- a/mojo/public/cpp/environment/lib/default_async_waiter.cc +++ b/mojo/public/cpp/environment/lib/default_async_waiter.cc @@ -51,7 +51,7 @@ class RunLoopHandlerImpl : public RunLoopHandler { MojoAsyncWaitCallback callback_; void* closure_; - MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoopHandlerImpl); + DISALLOW_COPY_AND_ASSIGN(RunLoopHandlerImpl); }; MojoAsyncWaitID AsyncWait(MojoHandle handle, diff --git a/mojo/public/cpp/environment/lib/environment.cc b/mojo/public/cpp/environment/lib/environment.cc index 8c7c930..0b0addd 100644 --- a/mojo/public/cpp/environment/lib/environment.cc +++ b/mojo/public/cpp/environment/lib/environment.cc @@ -79,7 +79,7 @@ void Environment::InstantiateDefaultRunLoop() { assert(!RunLoop::current()); // Not leaked: accessible from |RunLoop::current()|. RunLoop* run_loop = new RunLoop(); - MOJO_ALLOW_UNUSED_LOCAL(run_loop); + ALLOW_UNUSED_LOCAL(run_loop); assert(run_loop == RunLoop::current()); } diff --git a/mojo/public/cpp/environment/lib/scoped_task_tracking.h b/mojo/public/cpp/environment/lib/scoped_task_tracking.h index b6e32c1..4a8fb4f 100644 --- a/mojo/public/cpp/environment/lib/scoped_task_tracking.h +++ b/mojo/public/cpp/environment/lib/scoped_task_tracking.h @@ -5,8 +5,8 @@ #ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_ #define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_SCOPED_TASK_TRACKING_H_ +#include "base/macros.h" #include "mojo/public/cpp/environment/task_tracker.h" -#include "mojo/public/cpp/system/macros.h" namespace mojo { namespace internal { @@ -25,7 +25,7 @@ class ScopedTaskTracking { private: TaskTrackingId id_; - MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTaskTracking); + DISALLOW_COPY_AND_ASSIGN(ScopedTaskTracking); }; } // namespace internal diff --git a/mojo/public/cpp/environment/logging.h b/mojo/public/cpp/environment/logging.h index fb275db..834ba6b 100644 --- a/mojo/public/cpp/environment/logging.h +++ b/mojo/public/cpp/environment/logging.h @@ -14,6 +14,7 @@ #include <sstream> +#include "base/macros.h" #include "mojo/public/c/environment/logger.h" #include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/system/macros.h" @@ -81,7 +82,7 @@ class LogMessage { const int line_; std::ostringstream stream_; - MOJO_DISALLOW_COPY_AND_ASSIGN(LogMessage); + DISALLOW_COPY_AND_ASSIGN(LogMessage); }; // Used to ignore a stream. diff --git a/mojo/public/cpp/environment/tests/async_wait_unittest.cc b/mojo/public/cpp/environment/tests/async_wait_unittest.cc index 83c5ca0..8f77e67 100644 --- a/mojo/public/cpp/environment/tests/async_wait_unittest.cc +++ b/mojo/public/cpp/environment/tests/async_wait_unittest.cc @@ -35,7 +35,7 @@ class TestAsyncWaitCallback { int result_count_; MojoResult last_result_; - MOJO_DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); + DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); }; MojoAsyncWaitID CallAsyncWait(const Handle& handle, @@ -61,7 +61,7 @@ class AsyncWaitTest : public testing::Test { Environment environment_; RunLoop run_loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaitTest); + DISALLOW_COPY_AND_ASSIGN(AsyncWaitTest); }; // Verifies AsyncWaitCallback is notified when pipe is ready. diff --git a/mojo/public/cpp/environment/tests/async_waiter_unittest.cc b/mojo/public/cpp/environment/tests/async_waiter_unittest.cc index 1c1c2bf..3628788 100644 --- a/mojo/public/cpp/environment/tests/async_waiter_unittest.cc +++ b/mojo/public/cpp/environment/tests/async_waiter_unittest.cc @@ -29,7 +29,7 @@ class TestAsyncWaitCallback { int result_count_; MojoResult last_result_; - MOJO_DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); + DISALLOW_COPY_AND_ASSIGN(TestAsyncWaitCallback); }; // Manual code to create a callback since we don't have mojo::Bind yet. @@ -52,7 +52,7 @@ class AsyncWaiterTest : public testing::Test { Environment environment_; RunLoop run_loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiterTest); + DISALLOW_COPY_AND_ASSIGN(AsyncWaiterTest); }; // Verifies AsyncWaitCallback is notified when pipe is ready. diff --git a/mojo/public/cpp/environment/tests/logging_unittest.cc b/mojo/public/cpp/environment/tests/logging_unittest.cc index aca6792..8377252 100644 --- a/mojo/public/cpp/environment/tests/logging_unittest.cc +++ b/mojo/public/cpp/environment/tests/logging_unittest.cc @@ -94,7 +94,7 @@ class LoggingTest : public testing::Test { static std::string last_message_; static bool not_called_condition_was_called_; - MOJO_DISALLOW_COPY_AND_ASSIGN(LoggingTest); + DISALLOW_COPY_AND_ASSIGN(LoggingTest); }; // static diff --git a/mojo/public/cpp/system/BUILD.gn b/mojo/public/cpp/system/BUILD.gn index 91b8b28..d5298f2 100644 --- a/mojo/public/cpp/system/BUILD.gn +++ b/mojo/public/cpp/system/BUILD.gn @@ -14,6 +14,7 @@ source_set("system") { ] public_deps = [ + "//base", "//mojo/public/c/system", ] } diff --git a/mojo/public/cpp/system/buffer.h b/mojo/public/cpp/system/buffer.h index 0b03357..a69fbaa 100644 --- a/mojo/public/cpp/system/buffer.h +++ b/mojo/public/cpp/system/buffer.h @@ -15,6 +15,7 @@ #include <assert.h> #include <stdint.h> +#include "base/compiler_specific.h" #include "mojo/public/c/system/buffer.h" #include "mojo/public/cpp/system/handle.h" #include "mojo/public/cpp/system/macros.h" @@ -113,7 +114,7 @@ class SharedBuffer { inline SharedBuffer::SharedBuffer(uint64_t num_bytes) { MojoResult result = CreateSharedBuffer(nullptr, num_bytes, &handle); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); } @@ -121,7 +122,7 @@ inline SharedBuffer::SharedBuffer( uint64_t num_bytes, const MojoCreateSharedBufferOptions& options) { MojoResult result = CreateSharedBuffer(&options, num_bytes, &handle); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); } diff --git a/mojo/public/cpp/system/data_pipe.h b/mojo/public/cpp/system/data_pipe.h index 921b569..e4c46dc 100644 --- a/mojo/public/cpp/system/data_pipe.h +++ b/mojo/public/cpp/system/data_pipe.h @@ -15,6 +15,7 @@ #include <assert.h> #include <stdint.h> +#include "base/compiler_specific.h" #include "mojo/public/c/system/data_pipe.h" #include "mojo/public/cpp/system/handle.h" #include "mojo/public/cpp/system/macros.h" @@ -144,14 +145,14 @@ class DataPipe { inline DataPipe::DataPipe() { MojoResult result = CreateDataPipe(nullptr, &producer_handle, &consumer_handle); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); } inline DataPipe::DataPipe(const MojoCreateDataPipeOptions& options) { MojoResult result = CreateDataPipe(&options, &producer_handle, &consumer_handle); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); } diff --git a/mojo/public/cpp/system/handle.h b/mojo/public/cpp/system/handle.h index d49d83a..0104f47 100644 --- a/mojo/public/cpp/system/handle.h +++ b/mojo/public/cpp/system/handle.h @@ -9,6 +9,8 @@ #include <stdint.h> #include <limits> +#include "base/compiler_specific.h" +#include "base/macros.h" #include "mojo/public/c/system/functions.h" #include "mojo/public/c/system/types.h" #include "mojo/public/cpp/system/macros.h" @@ -123,7 +125,7 @@ class ScopedHandleBase { if (!handle_.is_valid()) return; MojoResult result = MojoClose(handle_.value()); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); } diff --git a/mojo/public/cpp/system/macros.h b/mojo/public/cpp/system/macros.h index d477891..979b57b 100644 --- a/mojo/public/cpp/system/macros.h +++ b/mojo/public/cpp/system/macros.h @@ -13,11 +13,6 @@ #include "mojo/public/c/system/macros.h" // Symbols exposed. -// A macro to disallow the copy constructor and operator= functions. -#define MOJO_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&) = delete; \ - void operator=(const TypeName&) = delete - // Used to calculate the number of elements in an array. // (See |arraysize()| in Chromium's base/macros.h for more details.) namespace mojo { diff --git a/mojo/public/cpp/system/message_pipe.h b/mojo/public/cpp/system/message_pipe.h index 72f0e46..b620155 100644 --- a/mojo/public/cpp/system/message_pipe.h +++ b/mojo/public/cpp/system/message_pipe.h @@ -15,6 +15,7 @@ #include <assert.h> #include <stdint.h> +#include "base/compiler_specific.h" #include "mojo/public/c/system/message_pipe.h" #include "mojo/public/cpp/system/handle.h" #include "mojo/public/cpp/system/macros.h" @@ -102,13 +103,13 @@ class MessagePipe { inline MessagePipe::MessagePipe() { MojoResult result = CreateMessagePipe(nullptr, &handle0, &handle1); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); } inline MessagePipe::MessagePipe(const MojoCreateMessagePipeOptions& options) { MojoResult result = CreateMessagePipe(&options, &handle0, &handle1); - MOJO_ALLOW_UNUSED_LOCAL(result); + ALLOW_UNUSED_LOCAL(result); assert(result == MOJO_RESULT_OK); } diff --git a/mojo/public/cpp/system/tests/macros_unittest.cc b/mojo/public/cpp/system/tests/macros_unittest.cc index e9daf52b..ab4c0b6 100644 --- a/mojo/public/cpp/system/tests/macros_unittest.cc +++ b/mojo/public/cpp/system/tests/macros_unittest.cc @@ -17,6 +17,7 @@ #include <stdlib.h> #include <utility> +#include "base/compiler_specific.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo { @@ -55,25 +56,6 @@ TEST(MacrosCppTest, Override) { x.AlsoToBeOverridden(); } -// Note: MSVS is very strict (and arguably buggy) about warnings for classes -// defined in a local scope, so define these globally. -class TestDisallowCopyAndAssignClass { - public: - TestDisallowCopyAndAssignClass() {} - explicit TestDisallowCopyAndAssignClass(int) {} - void NoOp() {} - - private: - MOJO_DISALLOW_COPY_AND_ASSIGN(TestDisallowCopyAndAssignClass); -}; - -TEST(MacrosCppTest, DisallowCopyAndAssign) { - TestDisallowCopyAndAssignClass x; - x.NoOp(); - TestDisallowCopyAndAssignClass y(789); - y.NoOp(); -} - // Test that |MOJO_ARRAYSIZE()| works in a |static_assert()|. const int kGlobalArray[5] = {1, 2, 3, 4, 5}; static_assert(MOJO_ARRAYSIZE(kGlobalArray) == 5u, @@ -83,7 +65,7 @@ TEST(MacrosCppTest, ArraySize) { double local_array[4] = {6.7, 7.8, 8.9, 9.0}; // MSVS considers this local variable unused since MOJO_ARRAYSIZE only takes // the size of the type of the local and not the values itself. - MOJO_ALLOW_UNUSED_LOCAL(local_array); + ALLOW_UNUSED_LOCAL(local_array); EXPECT_EQ(4u, MOJO_ARRAYSIZE(local_array)); } diff --git a/mojo/public/cpp/utility/lib/thread.cc b/mojo/public/cpp/utility/lib/thread.cc index 40f0bdd..d9c5e52 100644 --- a/mojo/public/cpp/utility/lib/thread.cc +++ b/mojo/public/cpp/utility/lib/thread.cc @@ -6,6 +6,8 @@ #include <assert.h> +#include "base/compiler_specific.h" + namespace mojo { Thread::Thread() : options_(), thread_(), started_(false), joined_(false) { @@ -26,7 +28,7 @@ void Thread::Start() { pthread_attr_t attr; int rv = pthread_attr_init(&attr); - MOJO_ALLOW_UNUSED_LOCAL(rv); + ALLOW_UNUSED_LOCAL(rv); assert(rv == 0); // Non-default stack size? @@ -50,7 +52,7 @@ void Thread::Join() { joined_ = true; int rv = pthread_join(thread_, nullptr); - MOJO_ALLOW_UNUSED_LOCAL(rv); + ALLOW_UNUSED_LOCAL(rv); assert(rv == 0); } diff --git a/mojo/public/cpp/utility/mutex.h b/mojo/public/cpp/utility/mutex.h index 4dc4aee..0f9bee0 100644 --- a/mojo/public/cpp/utility/mutex.h +++ b/mojo/public/cpp/utility/mutex.h @@ -11,6 +11,7 @@ #include <pthread.h> +#include "base/macros.h" #include "mojo/public/cpp/system/macros.h" namespace mojo { @@ -48,7 +49,7 @@ class Mutex { private: pthread_mutex_t mutex_; - MOJO_DISALLOW_COPY_AND_ASSIGN(Mutex); + DISALLOW_COPY_AND_ASSIGN(Mutex); }; class MutexLock { @@ -59,7 +60,7 @@ class MutexLock { private: Mutex* const mutex_; - MOJO_DISALLOW_COPY_AND_ASSIGN(MutexLock); + DISALLOW_COPY_AND_ASSIGN(MutexLock); }; // Catch bug where variable name is omitted (e.g., |MutexLock (&mu)|). diff --git a/mojo/public/cpp/utility/run_loop.h b/mojo/public/cpp/utility/run_loop.h index 407c58b..e46a8c6 100644 --- a/mojo/public/cpp/utility/run_loop.h +++ b/mojo/public/cpp/utility/run_loop.h @@ -151,7 +151,7 @@ class RunLoop { typedef std::priority_queue<PendingTask> DelayedTaskQueue; DelayedTaskQueue delayed_tasks_; - MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoop); + DISALLOW_COPY_AND_ASSIGN(RunLoop); }; } // namespace mojo diff --git a/mojo/public/cpp/utility/tests/mutex_unittest.cc b/mojo/public/cpp/utility/tests/mutex_unittest.cc index cfd8935..1604c8d 100644 --- a/mojo/public/cpp/utility/tests/mutex_unittest.cc +++ b/mojo/public/cpp/utility/tests/mutex_unittest.cc @@ -10,6 +10,7 @@ #include <vector> +#include "base/compiler_specific.h" #include "mojo/public/cpp/system/macros.h" #include "mojo/public/cpp/utility/thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -92,7 +93,7 @@ class Fiddler { (rand() % 10) * kNanosPerMilli // Nanoseconds. }; int rv = nanosleep(&req, nullptr); - MOJO_ALLOW_UNUSED_LOCAL(rv); + ALLOW_UNUSED_LOCAL(rv); assert(rv == 0); } @@ -102,7 +103,7 @@ class Fiddler { Mutex* const mutex_; int* const shared_value_; - MOJO_DISALLOW_COPY_AND_ASSIGN(Fiddler); + DISALLOW_COPY_AND_ASSIGN(Fiddler); }; class FiddlerThread : public Thread { @@ -119,7 +120,7 @@ class FiddlerThread : public Thread { private: Fiddler* const fiddler_; - MOJO_DISALLOW_COPY_AND_ASSIGN(FiddlerThread); + DISALLOW_COPY_AND_ASSIGN(FiddlerThread); }; // This does a stress test (that also checks exclusion). @@ -180,7 +181,7 @@ class TryThread : public Thread { Mutex* const mutex_; bool try_lock_succeeded_; - MOJO_DISALLOW_COPY_AND_ASSIGN(TryThread); + DISALLOW_COPY_AND_ASSIGN(TryThread); }; TEST(MutexTest, TryLock) { diff --git a/mojo/public/cpp/utility/tests/run_loop_unittest.cc b/mojo/public/cpp/utility/tests/run_loop_unittest.cc index fc06bdd..a49fd77 100644 --- a/mojo/public/cpp/utility/tests/run_loop_unittest.cc +++ b/mojo/public/cpp/utility/tests/run_loop_unittest.cc @@ -46,7 +46,7 @@ class TestRunLoopHandler : public RunLoopHandler { int error_count_; MojoResult last_error_result_; - MOJO_DISALLOW_COPY_AND_ASSIGN(TestRunLoopHandler); + DISALLOW_COPY_AND_ASSIGN(TestRunLoopHandler); }; class RunLoopTest : public testing::Test { @@ -63,7 +63,7 @@ class RunLoopTest : public testing::Test { } private: - MOJO_DISALLOW_COPY_AND_ASSIGN(RunLoopTest); + DISALLOW_COPY_AND_ASSIGN(RunLoopTest); }; // Trivial test to verify Run() with no added handles returns. @@ -88,7 +88,7 @@ class RemoveOnReadyRunLoopHandler : public TestRunLoopHandler { private: RunLoop* run_loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(RemoveOnReadyRunLoopHandler); + DISALLOW_COPY_AND_ASSIGN(RemoveOnReadyRunLoopHandler); }; // Verifies RunLoop quits when no more handles (handle is removed when ready). @@ -123,7 +123,7 @@ class QuitOnReadyRunLoopHandler : public TestRunLoopHandler { private: RunLoop* run_loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(QuitOnReadyRunLoopHandler); + DISALLOW_COPY_AND_ASSIGN(QuitOnReadyRunLoopHandler); }; // Verifies Quit() from OnHandleReady() quits the loop. @@ -158,7 +158,7 @@ class QuitOnErrorRunLoopHandler : public TestRunLoopHandler { private: RunLoop* run_loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(QuitOnErrorRunLoopHandler); + DISALLOW_COPY_AND_ASSIGN(QuitOnErrorRunLoopHandler); }; // Verifies Quit() when the deadline is reached works. @@ -211,7 +211,7 @@ class RemoveManyRunLoopHandler : public TestRunLoopHandler { std::vector<Handle> handles_; RunLoop* run_loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(RemoveManyRunLoopHandler); + DISALLOW_COPY_AND_ASSIGN(RemoveManyRunLoopHandler); }; // Test that handlers are notified of loop destruction. @@ -261,7 +261,7 @@ class AddHandlerOnErrorHandler : public TestRunLoopHandler { private: RunLoop* run_loop_; - MOJO_DISALLOW_COPY_AND_ASSIGN(AddHandlerOnErrorHandler); + DISALLOW_COPY_AND_ASSIGN(AddHandlerOnErrorHandler); }; TEST_F(RunLoopTest, AddHandlerOnError) { @@ -356,7 +356,7 @@ class NestingRunLoopHandler : public TestRunLoopHandler { size_t depth_; bool reached_depth_limit_; - MOJO_DISALLOW_COPY_AND_ASSIGN(NestingRunLoopHandler); + DISALLOW_COPY_AND_ASSIGN(NestingRunLoopHandler); }; const size_t NestingRunLoopHandler::kDepthLimit = 10; diff --git a/mojo/public/cpp/utility/tests/thread_unittest.cc b/mojo/public/cpp/utility/tests/thread_unittest.cc index 9c01cdd..54ba0f6 100644 --- a/mojo/public/cpp/utility/tests/thread_unittest.cc +++ b/mojo/public/cpp/utility/tests/thread_unittest.cc @@ -32,7 +32,7 @@ class SetIntThread : public Thread { int* const int_to_set_; const int value_; - MOJO_DISALLOW_COPY_AND_ASSIGN(SetIntThread); + DISALLOW_COPY_AND_ASSIGN(SetIntThread); }; TEST(ThreadTest, CreateAndJoin) { diff --git a/mojo/public/cpp/utility/thread.h b/mojo/public/cpp/utility/thread.h index b7d10ee..c3fb372 100644 --- a/mojo/public/cpp/utility/thread.h +++ b/mojo/public/cpp/utility/thread.h @@ -12,7 +12,7 @@ #include <pthread.h> #include <stddef.h> -#include "mojo/public/cpp/system/macros.h" +#include "base/macros.h" namespace mojo { @@ -54,7 +54,7 @@ class Thread { bool started_; bool joined_; - MOJO_DISALLOW_COPY_AND_ASSIGN(Thread); + DISALLOW_COPY_AND_ASSIGN(Thread); }; } // namespace mojo diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl index 8b20615..de7469c 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl @@ -183,7 +183,7 @@ void {{proxy_name}}::{{method.name}}( bool ok = receiver_->Accept(builder.message()); // This return value may be ignored as !ok implies the Connector has // encountered an error, which will be visible through other means. - MOJO_ALLOW_UNUSED_LOCAL(ok); + ALLOW_UNUSED_LOCAL(ok); {%- endif %} } {%- endfor %} @@ -242,7 +242,7 @@ void {{class_name}}_{{method.name}}_ProxyToResponder::Run( {{build_message(response_params_struct, "in_%s", params_description, "&serialization_context_")}} bool ok = responder_->Accept(builder.message()); - MOJO_ALLOW_UNUSED_LOCAL(ok); + ALLOW_UNUSED_LOCAL(ok); // TODO(darin): !ok returned here indicates a malformed message, and that may // be good reason to close the connection. However, we don't have a way to do // that from here. We should add a way. diff --git a/mojo/public/tools/bindings/generators/cpp_templates/union_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/union_definition.tmpl index 9e39e35..90d6152 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/union_definition.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/union_definition.tmpl @@ -29,7 +29,7 @@ bool {{class_name}}::Validate(const void* data, return false; } const {{class_name}}* object = static_cast<const {{class_name}}*>(data); - MOJO_ALLOW_UNUSED_LOCAL(object); + ALLOW_UNUSED_LOCAL(object); switch (object->tag) { {% for field in union.fields %} |