summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authoranujk.sharma <anujk.sharma@samsung.com>2015-01-21 21:39:37 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-22 05:41:28 +0000
commit5a7ffe2f6f9292109b801b1b6c7d82f6ab2a6d67 (patch)
tree98a737f4643e7d601a25d45497b7307ac168f1f3 /ipc
parente01f4987bc375367c9fe8c45eb23aeb27a31f8ed (diff)
downloadchromium_src-5a7ffe2f6f9292109b801b1b6c7d82f6ab2a6d67.zip
chromium_src-5a7ffe2f6f9292109b801b1b6c7d82f6ab2a6d67.tar.gz
chromium_src-5a7ffe2f6f9292109b801b1b6c7d82f6ab2a6d67.tar.bz2
Adding "static_assert" in lieu of "COMPILE_ASSERT" in ipc module
All our toolchains support c++'s static_assert now- COMPILE_ASSERT can be removed now. BUG=442514 Review URL: https://codereview.chromium.org/824243004 Cr-Commit-Position: refs/heads/master@{#312568}
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_channel_win.cc5
-rw-r--r--ipc/ipc_send_fds_test.cc6
-rw-r--r--ipc/unix_domain_socket_util.cc4
3 files changed, 8 insertions, 7 deletions
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc
index 2ad638b..384c892 100644
--- a/ipc/ipc_channel_win.cc
+++ b/ipc/ipc_channel_win.cc
@@ -29,8 +29,9 @@ ChannelWin::State::State(ChannelWin* channel) : is_pending(false) {
}
ChannelWin::State::~State() {
- COMPILE_ASSERT(!offsetof(ChannelWin::State, context),
- starts_with_io_context);
+ static_assert(offsetof(ChannelWin::State, context) == 0,
+ "ChannelWin::State should have context as its first data"
+ "member.");
}
ChannelWin::ChannelWin(const IPC::ChannelHandle &channel_handle,
diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc
index de2ae99..2e05e03 100644
--- a/ipc/ipc_send_fds_test.cc
+++ b/ipc/ipc_send_fds_test.cc
@@ -38,9 +38,9 @@ const unsigned kNumMessages = 20;
const char* kDevZeroPath = "/dev/zero";
#if defined(OS_POSIX)
-COMPILE_ASSERT(kNumFDsToSend ==
- IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage,
- num_fds_to_send_must_be_the_same_as_the_max_desc_per_message);
+static_assert(kNumFDsToSend ==
+ IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage,
+ "The number of FDs to send must be kMaxDescriptorsPerMessage.");
#endif
class MyChannelDescriptorListenerBase : public IPC::Listener {
diff --git a/ipc/unix_domain_socket_util.cc b/ipc/unix_domain_socket_util.cc
index d1ddd83..7405344 100644
--- a/ipc/unix_domain_socket_util.cc
+++ b/ipc/unix_domain_socket_util.cc
@@ -20,8 +20,8 @@
namespace IPC {
// Verify that kMaxSocketNameLength is a decent size.
-COMPILE_ASSERT(sizeof(((sockaddr_un*)0)->sun_path) >= kMaxSocketNameLength,
- BAD_SUN_PATH_LENGTH);
+static_assert(sizeof(((sockaddr_un*)0)->sun_path) >= kMaxSocketNameLength,
+ "sun_path is too long.");
namespace {