Remove COMPILE_ASSERT and use static_assert everywhere

COMPILE_ASSERT is no longer needed now that we have C++11's
static_assert.

R=aluebs@webrtc.org, andrew@webrtc.org, hellner@chromium.org, henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/39469004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@8058 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kwiberg@webrtc.org 2015-01-14 10:51:54 +00:00
parent 86e1e487e7
commit 2ebfac5649
30 changed files with 85 additions and 198 deletions

View File

@ -78,7 +78,6 @@
#include "third_party/libyuv/include/libyuv/video_common.h" #include "third_party/libyuv/include/libyuv/video_common.h"
#include "webrtc/base/bind.h" #include "webrtc/base/bind.h"
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/base/logging.h" #include "webrtc/base/logging.h"
#include "webrtc/base/messagequeue.h" #include "webrtc/base/messagequeue.h"
#include "webrtc/base/ssladapter.h" #include "webrtc/base/ssladapter.h"
@ -249,11 +248,11 @@ static JNIEnv* AttachCurrentThreadIfNeeded() {
// because the alternative (of silently passing a 32-bit pointer to a vararg // because the alternative (of silently passing a 32-bit pointer to a vararg
// function expecting a 64-bit param) picks up garbage in the high 32 bits. // function expecting a 64-bit param) picks up garbage in the high 32 bits.
static jlong jlongFromPointer(void* ptr) { static jlong jlongFromPointer(void* ptr) {
COMPILE_ASSERT(sizeof(intptr_t) <= sizeof(jlong), static_assert(sizeof(intptr_t) <= sizeof(jlong),
Time_to_rethink_the_use_of_jlongs); "Time to rethink the use of jlongs");
// Going through intptr_t to be obvious about the definedness of the // Going through intptr_t to be obvious about the definedness of the
// conversion from pointer to integral type. intptr_t to jlong is a standard // conversion from pointer to integral type. intptr_t to jlong is a standard
// widening by the COMPILE_ASSERT above. // widening by the static_assert above.
jlong ret = reinterpret_cast<intptr_t>(ptr); jlong ret = reinterpret_cast<intptr_t>(ptr);
assert(reinterpret_cast<void*>(ret) == ptr); assert(reinterpret_cast<void*>(ret) == ptr);
return ret; return ret;

View File

@ -106,7 +106,6 @@ static_library("rtc_base_approved") {
sources = [ sources = [
"checks.cc", "checks.cc",
"checks.h", "checks.h",
"compile_assert.h",
"exp_filter.cc", "exp_filter.cc",
"exp_filter.h", "exp_filter.h",
"md5.cc", "md5.cc",

View File

@ -41,7 +41,6 @@
'sources': [ 'sources': [
'checks.cc', 'checks.cc',
'checks.h', 'checks.h',
'compile_assert.h',
'exp_filter.cc', 'exp_filter.cc',
'exp_filter.h', 'exp_filter.h',
'md5.cc', 'md5.cc',

View File

@ -1,90 +0,0 @@
/*
* Copyright 2013 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// Borrowed from Chromium's src/base/macros.h.
#ifndef WEBRTC_BASE_COMPILE_ASSERT_H_
#define WEBRTC_BASE_COMPILE_ASSERT_H_
// The COMPILE_ASSERT macro can be used to verify that a compile time
// expression is true. For example, you could use it to verify the
// size of a static array:
//
// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
// content_type_names_incorrect_size);
//
// or to make sure a struct is smaller than a certain size:
//
// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
//
// The second argument to the macro is the name of the variable. If
// the expression is false, most compilers will issue a warning/error
// containing the name of the variable.
// TODO(ajm): Hack to avoid multiple definitions until the base/ of webrtc and
// libjingle are merged.
#if !defined(COMPILE_ASSERT)
#if __cplusplus >= 201103L
// Under C++11, just use static_assert.
#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
#else
template <bool>
struct CompileAssert {
};
#define COMPILE_ASSERT(expr, msg) \
typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#endif // __cplusplus >= 201103L
#endif // !defined(COMPILE_ASSERT)
// Implementation details of COMPILE_ASSERT:
//
// - COMPILE_ASSERT works by defining an array type that has -1
// elements (and thus is invalid) when the expression is false.
//
// - The simpler definition
//
// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
//
// does not work, as gcc supports variable-length arrays whose sizes
// are determined at run-time (this is gcc's extension and not part
// of the C++ standard). As a result, gcc fails to reject the
// following code with the simple definition:
//
// int foo;
// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
// // not a compile-time constant.
//
// - By using the type CompileAssert<(bool(expr))>, we ensures that
// expr is a compile-time constant. (Template arguments must be
// determined at compile-time.)
//
// - The outer parentheses in CompileAssert<(bool(expr))> are necessary
// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
//
// CompileAssert<bool(expr)>
//
// instead, these compilers will refuse to compile
//
// COMPILE_ASSERT(5 > 0, some_message);
//
// (They seem to think the ">" in "5 > 0" marks the end of the
// template argument list.)
//
// - The array size is (bool(expr) ? 1 : -1), instead of simply
//
// ((expr) ? 1 : -1).
//
// This is to avoid running into a bug in MS VC 7.1, which
// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
#endif // WEBRTC_BASE_COMPILE_ASSERT_H_

View File

@ -15,8 +15,6 @@
#include <limits> #include <limits>
#include "webrtc/base/compile_assert.h"
namespace rtc { namespace rtc {
namespace internal { namespace internal {
@ -177,10 +175,10 @@ struct RangeCheckImpl<Dst, Src, DST_UNSIGNED, SRC_SIGNED, OVERLAPS_RANGE> {
template <typename Dst, typename Src> template <typename Dst, typename Src>
inline RangeCheckResult RangeCheck(Src value) { inline RangeCheckResult RangeCheck(Src value) {
COMPILE_ASSERT(std::numeric_limits<Src>::is_specialized, static_assert(std::numeric_limits<Src>::is_specialized,
argument_must_be_numeric); "argument must be numeric");
COMPILE_ASSERT(std::numeric_limits<Dst>::is_specialized, static_assert(std::numeric_limits<Dst>::is_specialized,
result_must_be_numeric); "result must be numeric");
return RangeCheckImpl<Dst, Src>::Check(value); return RangeCheckImpl<Dst, Src>::Check(value);
} }

View File

@ -99,7 +99,6 @@
#include <algorithm> // For std::swap(). #include <algorithm> // For std::swap().
#include "webrtc/base/common.h" // for ASSERT #include "webrtc/base/common.h" // for ASSERT
#include "webrtc/base/compile_assert.h" // for COMPILE_ASSERT
#include "webrtc/base/move.h" // for RTC_MOVE_ONLY_TYPE_FOR_CPP_03 #include "webrtc/base/move.h" // for RTC_MOVE_ONLY_TYPE_FOR_CPP_03
#include "webrtc/base/template_util.h" // for is_convertible, is_array #include "webrtc/base/template_util.h" // for is_convertible, is_array
@ -121,7 +120,7 @@ struct DefaultDeleter {
// //
// Correct implementation should use SFINAE to disable this // Correct implementation should use SFINAE to disable this
// constructor. However, since there are no other 1-argument constructors, // constructor. However, since there are no other 1-argument constructors,
// using a COMPILE_ASSERT() based on is_convertible<> and requiring // using a static_assert based on is_convertible<> and requiring
// complete types is simpler and will cause compile failures for equivalent // complete types is simpler and will cause compile failures for equivalent
// misuses. // misuses.
// //
@ -130,8 +129,8 @@ struct DefaultDeleter {
// cannot convert to T*. // cannot convert to T*.
enum { T_must_be_complete = sizeof(T) }; enum { T_must_be_complete = sizeof(T) };
enum { U_must_be_complete = sizeof(U) }; enum { U_must_be_complete = sizeof(U) };
COMPILE_ASSERT((rtc::is_convertible<U*, T*>::value), static_assert(rtc::is_convertible<U*, T*>::value,
U_ptr_must_implicitly_convert_to_T_ptr); "U* must implicitly convert to T*");
} }
inline void operator()(T* ptr) const { inline void operator()(T* ptr) const {
enum { type_must_be_complete = sizeof(T) }; enum { type_must_be_complete = sizeof(T) };
@ -161,7 +160,7 @@ struct DefaultDeleter<T[]> {
template <class T, int n> template <class T, int n>
struct DefaultDeleter<T[n]> { struct DefaultDeleter<T[n]> {
// Never allow someone to declare something like scoped_ptr<int[10]>. // Never allow someone to declare something like scoped_ptr<int[10]>.
COMPILE_ASSERT(sizeof(T) == -1, do_not_use_array_with_size_as_type); static_assert(sizeof(T) == -1, "do not use array with size as type");
}; };
// Function object which invokes 'free' on its parameter, which must be // Function object which invokes 'free' on its parameter, which must be
@ -337,7 +336,7 @@ class scoped_ptr {
// implementation of scoped_ptr. // implementation of scoped_ptr.
template <typename U, typename V> template <typename U, typename V>
scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) { scoped_ptr(scoped_ptr<U, V> other) : impl_(&other.impl_) {
COMPILE_ASSERT(!rtc::is_array<U>::value, U_cannot_be_an_array); static_assert(!rtc::is_array<U>::value, "U cannot be an array");
} }
// Constructor. Move constructor for C++03 move emulation of this type. // Constructor. Move constructor for C++03 move emulation of this type.
@ -355,7 +354,7 @@ class scoped_ptr {
// scoped_ptr. // scoped_ptr.
template <typename U, typename V> template <typename U, typename V>
scoped_ptr& operator=(scoped_ptr<U, V> rhs) { scoped_ptr& operator=(scoped_ptr<U, V> rhs) {
COMPILE_ASSERT(!rtc::is_array<U>::value, U_cannot_be_an_array); static_assert(!rtc::is_array<U>::value, "U cannot be an array");
impl_.TakeState(&rhs.impl_); impl_.TakeState(&rhs.impl_);
return *this; return *this;
} }

View File

@ -85,7 +85,6 @@
// MSVC++ requires this to be set before any other includes to get M_PI. // MSVC++ requires this to be set before any other includes to get M_PI.
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include "webrtc/base/compile_assert.h"
#include "webrtc/common_audio/resampler/sinc_resampler.h" #include "webrtc/common_audio/resampler/sinc_resampler.h"
#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -15,7 +15,6 @@
#include <limits> #include <limits>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/common_audio/wav_header.h" #include "webrtc/common_audio/wav_header.h"
#include "webrtc/common_audio/wav_file.h" #include "webrtc/common_audio/wav_file.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"
@ -67,7 +66,7 @@ TEST(WavWriterTest, CPP) {
}; };
static const int kContentSize = static const int kContentSize =
kWavHeaderSize + kNumSamples * sizeof(int16_t) + sizeof(kMetadata); kWavHeaderSize + kNumSamples * sizeof(int16_t) + sizeof(kMetadata);
COMPILE_ASSERT(sizeof(kExpectedContents) == kContentSize, content_size); static_assert(sizeof(kExpectedContents) == kContentSize, "content size");
EXPECT_EQ(size_t(kContentSize), test::GetFileSize(outfile)); EXPECT_EQ(size_t(kContentSize), test::GetFileSize(outfile));
FILE* f = fopen(outfile.c_str(), "rb"); FILE* f = fopen(outfile.c_str(), "rb");
ASSERT_TRUE(f); ASSERT_TRUE(f);
@ -123,7 +122,7 @@ TEST(WavWriterTest, C) {
}; };
static const int kContentSize = static const int kContentSize =
kWavHeaderSize + kNumSamples * sizeof(int16_t); kWavHeaderSize + kNumSamples * sizeof(int16_t);
COMPILE_ASSERT(sizeof(kExpectedContents) == kContentSize, content_size); static_assert(sizeof(kExpectedContents) == kContentSize, "content size");
EXPECT_EQ(size_t(kContentSize), test::GetFileSize(outfile)); EXPECT_EQ(size_t(kContentSize), test::GetFileSize(outfile));
FILE* f = fopen(outfile.c_str(), "rb"); FILE* f = fopen(outfile.c_str(), "rb");
ASSERT_TRUE(f); ASSERT_TRUE(f);

View File

@ -29,7 +29,7 @@ struct ChunkHeader {
uint32_t ID; uint32_t ID;
uint32_t Size; uint32_t Size;
}; };
COMPILE_ASSERT(sizeof(ChunkHeader) == 8, chunk_header_size); static_assert(sizeof(ChunkHeader) == 8, "ChunkHeader size");
// We can't nest this definition in WavHeader, because VS2013 gives an error // We can't nest this definition in WavHeader, because VS2013 gives an error
// on sizeof(WavHeader::fmt): "error C2070: 'unknown': illegal sizeof operand". // on sizeof(WavHeader::fmt): "error C2070: 'unknown': illegal sizeof operand".
@ -42,7 +42,7 @@ struct FmtSubchunk {
uint16_t BlockAlign; uint16_t BlockAlign;
uint16_t BitsPerSample; uint16_t BitsPerSample;
}; };
COMPILE_ASSERT(sizeof(FmtSubchunk) == 24, fmt_subchunk_size); static_assert(sizeof(FmtSubchunk) == 24, "FmtSubchunk size");
const uint32_t kFmtSubchunkSize = sizeof(FmtSubchunk) - sizeof(ChunkHeader); const uint32_t kFmtSubchunkSize = sizeof(FmtSubchunk) - sizeof(ChunkHeader);
struct WavHeader { struct WavHeader {
@ -55,7 +55,7 @@ struct WavHeader {
ChunkHeader header; ChunkHeader header;
} data; } data;
}; };
COMPILE_ASSERT(sizeof(WavHeader) == kWavHeaderSize, no_padding_in_header); static_assert(sizeof(WavHeader) == kWavHeaderSize, "no padding in header");
} // namespace } // namespace

View File

@ -11,7 +11,6 @@
#include <limits> #include <limits>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/common_audio/wav_header.h" #include "webrtc/common_audio/wav_header.h"
namespace webrtc { namespace webrtc {
@ -266,7 +265,7 @@ TEST(WavHeaderTest, WriteAndReadWavHeader) {
0x99, 0xd0, 0x5b, 0x07, // size of payload: 123457689 0x99, 0xd0, 0x5b, 0x07, // size of payload: 123457689
0xa4, 0xa4, 0xa4, 0xa4, // untouched bytes after header 0xa4, 0xa4, 0xa4, 0xa4, // untouched bytes after header
}; };
COMPILE_ASSERT(sizeof(kExpectedBuf) == kSize, buf_size); static_assert(sizeof(kExpectedBuf) == kSize, "buffer size");
EXPECT_EQ(0, memcmp(kExpectedBuf, buf, kSize)); EXPECT_EQ(0, memcmp(kExpectedBuf, buf, kSize));
int num_channels = 0; int num_channels = 0;

View File

@ -13,7 +13,6 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/base/md5digest.h" #include "webrtc/base/md5digest.h"
#include "webrtc/base/thread_annotations.h" #include "webrtc/base/thread_annotations.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_receive_test.h" #include "webrtc/modules/audio_coding/main/acm2/acm_receive_test.h"
@ -133,8 +132,8 @@ class AudioCodingModuleTest : public ::testing::Test {
input_frame_.sample_rate_hz_ = kSampleRateHz; input_frame_.sample_rate_hz_ = kSampleRateHz;
input_frame_.num_channels_ = 1; input_frame_.num_channels_ = 1;
input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms. input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms.
COMPILE_ASSERT(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples, static_assert(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples,
audio_frame_too_small); "audio frame too small");
memset(input_frame_.data_, memset(input_frame_.data_,
0, 0,
input_frame_.samples_per_channel_ * sizeof(input_frame_.data_[0])); input_frame_.samples_per_channel_ * sizeof(input_frame_.data_[0]));
@ -461,7 +460,7 @@ class AcmIsacMtTest : public AudioCodingModuleMtTest {
} }
virtual void RegisterCodec() OVERRIDE { virtual void RegisterCodec() OVERRIDE {
COMPILE_ASSERT(kSampleRateHz == 16000, test_designed_for_isac_16khz); static_assert(kSampleRateHz == 16000, "test designed for iSAC 16 kHz");
// Register iSAC codec in ACM, effectively unregistering the PCM16B codec // Register iSAC codec in ACM, effectively unregistering the PCM16B codec
// registered in AudioCodingModuleTest::SetUp(); // registered in AudioCodingModuleTest::SetUp();

View File

@ -12,7 +12,6 @@
#include <vector> #include <vector>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/base/md5digest.h" #include "webrtc/base/md5digest.h"
#include "webrtc/base/thread_annotations.h" #include "webrtc/base/thread_annotations.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_receive_test_oldapi.h" #include "webrtc/modules/audio_coding/main/acm2/acm_receive_test_oldapi.h"
@ -137,8 +136,8 @@ class AudioCodingModuleTestOldApi : public ::testing::Test {
input_frame_.sample_rate_hz_ = kSampleRateHz; input_frame_.sample_rate_hz_ = kSampleRateHz;
input_frame_.num_channels_ = 1; input_frame_.num_channels_ = 1;
input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms. input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms.
COMPILE_ASSERT(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples, static_assert(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples,
audio_frame_too_small); "audio frame too small");
memset(input_frame_.data_, memset(input_frame_.data_,
0, 0,
input_frame_.samples_per_channel_ * sizeof(input_frame_.data_[0])); input_frame_.samples_per_channel_ * sizeof(input_frame_.data_[0]));
@ -463,7 +462,7 @@ class AcmIsacMtTestOldApi : public AudioCodingModuleMtTestOldApi {
} }
virtual void RegisterCodec() { virtual void RegisterCodec() {
COMPILE_ASSERT(kSampleRateHz == 16000, test_designed_for_isac_16khz); static_assert(kSampleRateHz == 16000, "test designed for iSAC 16 kHz");
AudioCodingModule::Codec("ISAC", &codec_, kSampleRateHz, 1); AudioCodingModule::Codec("ISAC", &codec_, kSampleRateHz, 1);
codec_.pltype = kPayloadType; codec_.pltype = kPayloadType;

View File

@ -15,7 +15,6 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h" #include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h" #include "webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
@ -360,11 +359,11 @@ TEST_F(LargeTimestampJumpTest, JumpLongerThanHalfRange) {
static const uint32_t kStartTimestamp = 2880; static const uint32_t kStartTimestamp = 2880;
static const uint32_t kJumpFromTimestamp = 7200; static const uint32_t kJumpFromTimestamp = 7200;
static const uint32_t kJumpToTimestamp = 2869342376; static const uint32_t kJumpToTimestamp = 2869342376;
COMPILE_ASSERT(kJumpFromTimestamp < kJumpToTimestamp, static_assert(kJumpFromTimestamp < kJumpToTimestamp,
timestamp_jump_should_not_result_in_wrap); "timestamp jump should not result in wrap");
COMPILE_ASSERT( static_assert(
static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) > 0x7FFFFFFF, static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) > 0x7FFFFFFF,
jump_should_be_larger_than_half_range); "jump should be larger than half range");
// Replace the default RTP generator with one that jumps in timestamp. // Replace the default RTP generator with one that jumps in timestamp.
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_, rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
kStartSeqeunceNumber, kStartSeqeunceNumber,
@ -384,11 +383,11 @@ TEST_F(LargeTimestampJumpTest, JumpLongerThanHalfRangeAndWrap) {
static const uint32_t kStartTimestamp = 3221223116; static const uint32_t kStartTimestamp = 3221223116;
static const uint32_t kJumpFromTimestamp = 3221223216; static const uint32_t kJumpFromTimestamp = 3221223216;
static const uint32_t kJumpToTimestamp = 1073744278; static const uint32_t kJumpToTimestamp = 1073744278;
COMPILE_ASSERT(kJumpToTimestamp < kJumpFromTimestamp, static_assert(kJumpToTimestamp < kJumpFromTimestamp,
timestamp_jump_should_result_in_wrap); "timestamp jump should result in wrap");
COMPILE_ASSERT( static_assert(
static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) > 0x7FFFFFFF, static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) > 0x7FFFFFFF,
jump_should_be_larger_than_half_range); "jump should be larger than half range");
// Replace the default RTP generator with one that jumps in timestamp. // Replace the default RTP generator with one that jumps in timestamp.
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_, rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
kStartSeqeunceNumber, kStartSeqeunceNumber,
@ -443,11 +442,11 @@ TEST_F(ShortTimestampJumpTest, JumpShorterThanHalfRange) {
static const uint32_t kStartTimestamp = 4711; static const uint32_t kStartTimestamp = 4711;
static const uint32_t kJumpFromTimestamp = 4811; static const uint32_t kJumpFromTimestamp = 4811;
static const uint32_t kJumpToTimestamp = 2147483747; static const uint32_t kJumpToTimestamp = 2147483747;
COMPILE_ASSERT(kJumpFromTimestamp < kJumpToTimestamp, static_assert(kJumpFromTimestamp < kJumpToTimestamp,
timestamp_jump_should_not_result_in_wrap); "timestamp jump should not result in wrap");
COMPILE_ASSERT( static_assert(
static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) < 0x7FFFFFFF, static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) < 0x7FFFFFFF,
jump_should_be_smaller_than_half_range); "jump should be smaller than half range");
// Replace the default RTP generator with one that jumps in timestamp. // Replace the default RTP generator with one that jumps in timestamp.
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_, rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
kStartSeqeunceNumber, kStartSeqeunceNumber,
@ -467,11 +466,11 @@ TEST_F(ShortTimestampJumpTest, JumpShorterThanHalfRangeAndWrap) {
static const uint32_t kStartTimestamp = 3221227827; static const uint32_t kStartTimestamp = 3221227827;
static const uint32_t kJumpFromTimestamp = 3221227927; static const uint32_t kJumpFromTimestamp = 3221227927;
static const uint32_t kJumpToTimestamp = 1073739567; static const uint32_t kJumpToTimestamp = 1073739567;
COMPILE_ASSERT(kJumpToTimestamp < kJumpFromTimestamp, static_assert(kJumpToTimestamp < kJumpFromTimestamp,
timestamp_jump_should_result_in_wrap); "timestamp jump should result in wrap");
COMPILE_ASSERT( static_assert(
static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) < 0x7FFFFFFF, static_cast<uint32_t>(kJumpToTimestamp - kJumpFromTimestamp) < 0x7FFFFFFF,
jump_should_be_smaller_than_half_range); "jump should be smaller than half range");
// Replace the default RTP generator with one that jumps in timestamp. // Replace the default RTP generator with one that jumps in timestamp.
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_, rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
kStartSeqeunceNumber, kStartSeqeunceNumber,

View File

@ -13,7 +13,6 @@
#include <string> #include <string>
#include "webrtc/base/compile_assert.h"
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/md5digest.h" #include "webrtc/base/md5digest.h"
#include "webrtc/base/stringencode.h" #include "webrtc/base/stringencode.h"

View File

@ -15,7 +15,6 @@
#include <algorithm> #include <algorithm>
#include "webrtc/base/compile_assert.h"
#include "webrtc/common_audio/resampler/include/resampler.h" #include "webrtc/common_audio/resampler/include/resampler.h"
#include "webrtc/modules/audio_processing/agc/agc_audio_proc.h" #include "webrtc/modules/audio_processing/agc/agc_audio_proc.h"
#include "webrtc/modules/audio_processing/agc/common.h" #include "webrtc/modules/audio_processing/agc/common.h"
@ -99,8 +98,8 @@ int Agc::Process(const int16_t* audio, int length, int sample_rate_hz) {
// Initialize to 0.5 which is a neutral value for combining probabilities, // Initialize to 0.5 which is a neutral value for combining probabilities,
// in case the standalone-VAD is not enabled. // in case the standalone-VAD is not enabled.
double p_combined[] = {0.5, 0.5, 0.5, 0.5}; double p_combined[] = {0.5, 0.5, 0.5, 0.5};
COMPILE_ASSERT(sizeof(p_combined) / sizeof(p_combined[0]) == kMaxNumFrames, static_assert(sizeof(p_combined) / sizeof(p_combined[0]) == kMaxNumFrames,
combined_probability_incorrect_size); "combined probability incorrect size");
if (standalone_vad_enabled_) { if (standalone_vad_enabled_) {
if (standalone_vad_->GetActivity(p_combined, kMaxNumFrames) < 0) if (standalone_vad_->GetActivity(p_combined, kMaxNumFrames) < 0)
return -1; return -1;

View File

@ -13,7 +13,6 @@
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/audio_processing/agc/agc_audio_proc_internal.h" #include "webrtc/modules/audio_processing/agc/agc_audio_proc_internal.h"
#include "webrtc/modules/audio_processing/agc/pitch_internal.h" #include "webrtc/modules/audio_processing/agc/pitch_internal.h"
#include "webrtc/modules/audio_processing/agc/pole_zero_filter.h" #include "webrtc/modules/audio_processing/agc/pole_zero_filter.h"
@ -47,11 +46,11 @@ AgcAudioProc::AgcAudioProc()
pre_filter_handle_(new PreFiltBankstr), pre_filter_handle_(new PreFiltBankstr),
high_pass_filter_(PoleZeroFilter::Create( high_pass_filter_(PoleZeroFilter::Create(
kCoeffNumerator, kFilterOrder, kCoeffDenominator, kFilterOrder)) { kCoeffNumerator, kFilterOrder, kCoeffDenominator, kFilterOrder)) {
COMPILE_ASSERT(kNumPastSignalSamples + kNumSubframeSamples == static_assert(kNumPastSignalSamples + kNumSubframeSamples ==
sizeof(kLpcAnalWin) / sizeof(kLpcAnalWin[0]), sizeof(kLpcAnalWin) / sizeof(kLpcAnalWin[0]),
lpc_analysis_window_incorrect_size); "lpc analysis window incorrect size");
COMPILE_ASSERT(kLpcOrder + 1 == sizeof(kCorrWeight) / sizeof(kCorrWeight[0]), static_assert(kLpcOrder + 1 == sizeof(kCorrWeight) / sizeof(kCorrWeight[0]),
correlation_weight_incorrect_size); "correlation weight incorrect size");
// TODO(turajs): Are we doing too much in the constructor? // TODO(turajs): Are we doing too much in the constructor?
float data[kDftSize]; float data[kDftSize];

View File

@ -11,8 +11,6 @@
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_AUDIO_PROC_INTERNAL_H_ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_AUDIO_PROC_INTERNAL_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_AUDIO_PROC_INTERNAL_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_AUDIO_PROC_INTERNAL_H_
#include "webrtc/base/compile_assert.h"
namespace webrtc { namespace webrtc {
// These values should match MATLAB counterparts for unit-tests to pass. // These values should match MATLAB counterparts for unit-tests to pass.
@ -71,10 +69,12 @@ static const float kCoeffNumerator[kFilterOrder + 1] = {0.974827f, -1.949650f,
static const float kCoeffDenominator[kFilterOrder + 1] = {1.0f, -1.971999f, static const float kCoeffDenominator[kFilterOrder + 1] = {1.0f, -1.971999f,
0.972457f}; 0.972457f};
COMPILE_ASSERT(kFilterOrder + 1 == sizeof(kCoeffNumerator) / static_assert(kFilterOrder + 1 ==
sizeof(kCoeffNumerator[0]), numerator_coefficients_incorrect_size); sizeof(kCoeffNumerator) / sizeof(kCoeffNumerator[0]),
COMPILE_ASSERT(kFilterOrder + 1 == sizeof(kCoeffDenominator) / "numerator coefficients incorrect size");
sizeof(kCoeffDenominator[0]), denominator_coefficients_incorrect_size); static_assert(kFilterOrder + 1 ==
sizeof(kCoeffDenominator) / sizeof(kCoeffDenominator[0]),
"denominator coefficients incorrect size");
} // namespace webrtc } // namespace webrtc

View File

@ -17,7 +17,6 @@
#include <cstdio> #include <cstdio>
#endif #endif
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/audio_processing/agc/gain_map_internal.h" #include "webrtc/modules/audio_processing/agc/gain_map_internal.h"
#include "webrtc/modules/audio_processing/gain_control_impl.h" #include "webrtc/modules/audio_processing/gain_control_impl.h"
#include "webrtc/modules/interface/module_common_types.h" #include "webrtc/modules/interface/module_common_types.h"
@ -47,7 +46,7 @@ const int kMinCompressionGain = 2;
const float kCompressionGainStep = 0.05f; const float kCompressionGainStep = 0.05f;
const int kMaxMicLevel = 255; const int kMaxMicLevel = 255;
COMPILE_ASSERT(kGainMapSize > kMaxMicLevel, gain_map_too_small); static_assert(kGainMapSize > kMaxMicLevel, "gain map too small");
const int kMinMicLevel = 12; const int kMinMicLevel = 12;
const int kMinInitMicLevel = 85; const int kMinInitMicLevel = 85;

View File

@ -13,7 +13,6 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/interface/module_common_types.h" #include "webrtc/modules/interface/module_common_types.h"
namespace webrtc { namespace webrtc {
@ -69,8 +68,9 @@ Histogram::Histogram()
buffer_is_full_(false), buffer_is_full_(false),
len_circular_buffer_(0), len_circular_buffer_(0),
len_high_activity_(0) { len_high_activity_(0) {
COMPILE_ASSERT(kHistSize == sizeof(kHistBinCenters) / static_assert(
sizeof(kHistBinCenters[0]), histogram_bin_centers_incorrect_size); kHistSize == sizeof(kHistBinCenters) / sizeof(kHistBinCenters[0]),
"histogram bin centers incorrect size");
} }
Histogram::Histogram(int window_size) Histogram::Histogram(int window_size)

View File

@ -14,7 +14,6 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/audio_processing/agc/circular_buffer.h" #include "webrtc/modules/audio_processing/agc/circular_buffer.h"
#include "webrtc/modules/audio_processing/agc/common.h" #include "webrtc/modules/audio_processing/agc/common.h"
#include "webrtc/modules/audio_processing/agc/noise_gmm_tables.h" #include "webrtc/modules/audio_processing/agc/noise_gmm_tables.h"
@ -23,8 +22,8 @@
namespace webrtc { namespace webrtc {
COMPILE_ASSERT(kNoiseGmmDim == kVoiceGmmDim, static_assert(kNoiseGmmDim == kVoiceGmmDim,
noise_and_voice_gmm_dimension_not_equal); "noise and voice gmm dimension not equal");
// These values should match MATLAB counterparts for unit-tests to pass. // These values should match MATLAB counterparts for unit-tests to pass.
static const int kPosteriorHistorySize = 500; // 5 sec of 10 ms frames. static const int kPosteriorHistorySize = 500; // 5 sec of 10 ms frames.

View File

@ -14,7 +14,6 @@
#include <stdio.h> #include <stdio.h>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/audio_processing/agc/agc_audio_proc_internal.h" #include "webrtc/modules/audio_processing/agc/agc_audio_proc_internal.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"

View File

@ -12,7 +12,6 @@
#include <assert.h> #include <assert.h>
#include "webrtc/base/compile_assert.h"
#include "webrtc/base/platform_file.h" #include "webrtc/base/platform_file.h"
#include "webrtc/common_audio/include/audio_util.h" #include "webrtc/common_audio/include/audio_util.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
@ -55,7 +54,7 @@
namespace webrtc { namespace webrtc {
// Throughout webrtc, it's assumed that success is represented by zero. // Throughout webrtc, it's assumed that success is represented by zero.
COMPILE_ASSERT(AudioProcessing::kNoError == 0, no_error_must_be_zero); static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero");
// This class has two main functionalities: // This class has two main functionalities:
// //

View File

@ -13,7 +13,6 @@
#include <string.h> #include <string.h>
#include "webrtc/base/compile_assert.h"
#include "webrtc/system_wrappers/interface/file_wrapper.h" #include "webrtc/system_wrappers/interface/file_wrapper.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
@ -24,8 +23,8 @@ namespace webrtc {
template <class Dest, class Source> template <class Dest, class Source>
inline Dest bit_cast(const Source& source) { inline Dest bit_cast(const Source& source) {
// A compile error here means your Dest and Source have different sizes. // A compile error here means your Dest and Source have different sizes.
COMPILE_ASSERT(sizeof(Dest) == sizeof(Source), static_assert(sizeof(Dest) == sizeof(Source),
dest_and_source_have_different_sizes); "Dest and Source have different sizes");
Dest dest; Dest dest;
memcpy(&dest, &source, sizeof(dest)); memcpy(&dest, &source, sizeof(dest));

View File

@ -12,7 +12,6 @@
#include <algorithm> #include <algorithm>
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/desktop_capture/win/scoped_gdi_object.h" #include "webrtc/modules/desktop_capture/win/scoped_gdi_object.h"
#include "webrtc/modules/desktop_capture/desktop_frame.h" #include "webrtc/modules/desktop_capture/desktop_frame.h"
#include "webrtc/modules/desktop_capture/desktop_geometry.h" #include "webrtc/modules/desktop_capture/desktop_geometry.h"
@ -78,8 +77,8 @@ void AddCursorOutline(int width, int height, uint32_t* data) {
// Premultiplies RGB components of the pixel data in the given image by // Premultiplies RGB components of the pixel data in the given image by
// the corresponding alpha components. // the corresponding alpha components.
void AlphaMul(uint32_t* data, int width, int height) { void AlphaMul(uint32_t* data, int width, int height) {
COMPILE_ASSERT(sizeof(uint32_t) == kBytesPerPixel, static_assert(sizeof(uint32_t) == kBytesPerPixel,
size_of_uint32_should_be_the_bytes_per_pixel); "size of uint32 should be the number of bytes per pixel");
for (uint32_t* data_end = data + width * height; data != data_end; ++data) { for (uint32_t* data_end = data + width * height; data != data_end; ++data) {
RGBQUAD* from = reinterpret_cast<RGBQUAD*>(data); RGBQUAD* from = reinterpret_cast<RGBQUAD*>(data);

View File

@ -9,7 +9,6 @@
*/ */
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/media_file/interface/media_file.h" #include "webrtc/modules/media_file/interface/media_file.h"
#include "webrtc/system_wrappers/interface/sleep.h" #include "webrtc/system_wrappers/interface/sleep.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"
@ -78,7 +77,7 @@ TEST_F(MediaFileTest, WriteWavFile) {
'd', 'a', 't', 'a', 'd', 'a', 't', 'a',
0x40, 0x1, 0, 0, // size of payload: 320 0x40, 0x1, 0, 0, // size of payload: 320
}; };
COMPILE_ASSERT(sizeof(kExpectedHeader) == kHeaderSize, header_size); static_assert(sizeof(kExpectedHeader) == kHeaderSize, "header size");
EXPECT_EQ(kHeaderSize + kPayloadSize, webrtc::test::GetFileSize(outfile)); EXPECT_EQ(kHeaderSize + kPayloadSize, webrtc::test::GetFileSize(outfile));
FILE* f = fopen(outfile.c_str(), "rb"); FILE* f = fopen(outfile.c_str(), "rb");

View File

@ -14,14 +14,13 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/compile_assert.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h" #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h" #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
#define CHECK_ARRAY_SIZE(expected_size, array) \ #define CHECK_ARRAY_SIZE(expected_size, array) \
COMPILE_ASSERT(expected_size == sizeof(array) / sizeof(array[0]), \ static_assert(expected_size == sizeof(array) / sizeof(array[0]), \
check_array_size); "check array size");
namespace webrtc { namespace webrtc {
namespace { namespace {

View File

@ -40,8 +40,8 @@ void (*g_logging_delegate_function)(const std::string&) = NULL;
void (*g_extra_logging_init_function)( void (*g_extra_logging_init_function)(
void (*logging_delegate_function)(const std::string&)) = NULL; void (*logging_delegate_function)(const std::string&)) = NULL;
#ifndef NDEBUG #ifndef NDEBUG
COMPILE_ASSERT(sizeof(base::subtle::Atomic32) == sizeof(base::PlatformThreadId), static_assert(sizeof(base::subtle::Atomic32) == sizeof(base::PlatformThreadId),
atomic32_not_same_size_as_platformthreadid); "Atomic32 not same size as PlatformThreadId");
base::subtle::Atomic32 g_init_logging_delegate_thread_id = 0; base::subtle::Atomic32 g_init_logging_delegate_thread_id = 0;
#endif #endif

View File

@ -11,8 +11,10 @@
#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_ #ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_
#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_ #define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_
// Only use this for C files. For C++, use compile_assert.h. #ifdef __cplusplus
// #error "Only use this for C files. For C++, use static_assert."
#endif
// Use this macro to verify at compile time that certain restrictions are met. // Use this macro to verify at compile time that certain restrictions are met.
// The argument is the boolean expression to evaluate. // The argument is the boolean expression to evaluate.
// Example: // Example:

View File

@ -104,7 +104,6 @@
#include <algorithm> // For std::swap(). #include <algorithm> // For std::swap().
#include "webrtc/base/compile_assert.h"
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/move.h" #include "webrtc/base/move.h"
#include "webrtc/base/template_util.h" #include "webrtc/base/template_util.h"
@ -124,7 +123,7 @@ struct DefaultDeleter {
// //
// Correct implementation should use SFINAE to disable this // Correct implementation should use SFINAE to disable this
// constructor. However, since there are no other 1-argument constructors, // constructor. However, since there are no other 1-argument constructors,
// using a COMPILE_ASSERT() based on is_convertible<> and requiring // using a static_assert based on is_convertible<> and requiring
// complete types is simpler and will cause compile failures for equivalent // complete types is simpler and will cause compile failures for equivalent
// misuses. // misuses.
// //
@ -133,8 +132,8 @@ struct DefaultDeleter {
// cannot convert to T*. // cannot convert to T*.
enum { T_must_be_complete = sizeof(T) }; enum { T_must_be_complete = sizeof(T) };
enum { U_must_be_complete = sizeof(U) }; enum { U_must_be_complete = sizeof(U) };
COMPILE_ASSERT((rtc::is_convertible<U*, T*>::value), static_assert(rtc::is_convertible<U*, T*>::value,
U_ptr_must_implicitly_convert_to_T_ptr); "U* must implicitly convert to T*");
} }
inline void operator()(T* ptr) const { inline void operator()(T* ptr) const {
enum { type_must_be_complete = sizeof(T) }; enum { type_must_be_complete = sizeof(T) };
@ -164,7 +163,7 @@ struct DefaultDeleter<T[]> {
template <class T, int n> template <class T, int n>
struct DefaultDeleter<T[n]> { struct DefaultDeleter<T[n]> {
// Never allow someone to declare something like scoped_ptr<int[10]>. // Never allow someone to declare something like scoped_ptr<int[10]>.
COMPILE_ASSERT(sizeof(T) == -1, do_not_use_array_with_size_as_type); static_assert(sizeof(T) == -1, "do not use array with size as type");
}; };
// Function object which invokes 'free' on its parameter, which must be // Function object which invokes 'free' on its parameter, which must be
@ -318,8 +317,8 @@ class scoped_ptr {
// TODO(ajm): If we ever import RefCountedBase, this check needs to be // TODO(ajm): If we ever import RefCountedBase, this check needs to be
// enabled. // enabled.
//COMPILE_ASSERT(webrtc::internal::IsNotRefCounted<T>::value, //static_assert(webrtc::internal::IsNotRefCounted<T>::value,
// T_is_refcounted_type_and_needs_scoped_refptr); // "T is refcounted type and needs scoped refptr");
public: public:
// The element and deleter types. // The element and deleter types.
@ -351,7 +350,7 @@ class scoped_ptr {
template <typename U, typename V> template <typename U, typename V>
scoped_ptr(scoped_ptr<U, V>&& other) scoped_ptr(scoped_ptr<U, V>&& other)
: impl_(&other.impl_) { : impl_(&other.impl_) {
COMPILE_ASSERT(!rtc::is_array<U>::value, U_cannot_be_an_array); static_assert(!rtc::is_array<U>::value, "U cannot be an array");
} }
// operator=. Allows assignment from a scoped_ptr rvalue for a convertible // operator=. Allows assignment from a scoped_ptr rvalue for a convertible
@ -366,7 +365,7 @@ class scoped_ptr {
// scoped_ptr. // scoped_ptr.
template <typename U, typename V> template <typename U, typename V>
scoped_ptr& operator=(scoped_ptr<U, V>&& rhs) { scoped_ptr& operator=(scoped_ptr<U, V>&& rhs) {
COMPILE_ASSERT(!rtc::is_array<U>::value, U_cannot_be_an_array); static_assert(!rtc::is_array<U>::value, "U cannot be an array");
impl_.TakeState(&rhs.impl_); impl_.TakeState(&rhs.impl_);
return *this; return *this;
} }

View File

@ -13,15 +13,14 @@
#include <assert.h> #include <assert.h>
#include <windows.h> #include <windows.h>
#include "webrtc/base/compile_assert.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
namespace webrtc { namespace webrtc {
Atomic32::Atomic32(int32_t initial_value) Atomic32::Atomic32(int32_t initial_value)
: value_(initial_value) { : value_(initial_value) {
COMPILE_ASSERT(sizeof(value_) == sizeof(LONG), static_assert(sizeof(value_) == sizeof(LONG),
counter_variable_is_the_expected_size); "counter variable is the expected size");
assert(Is32bitAligned()); assert(Is32bitAligned());
} }