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:
@ -13,7 +13,6 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/compile_assert.h"
|
||||
#include "webrtc/base/md5digest.h"
|
||||
#include "webrtc/base/thread_annotations.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_.num_channels_ = 1;
|
||||
input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms.
|
||||
COMPILE_ASSERT(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples,
|
||||
audio_frame_too_small);
|
||||
static_assert(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples,
|
||||
"audio frame too small");
|
||||
memset(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 {
|
||||
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
|
||||
// registered in AudioCodingModuleTest::SetUp();
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/compile_assert.h"
|
||||
#include "webrtc/base/md5digest.h"
|
||||
#include "webrtc/base/thread_annotations.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_.num_channels_ = 1;
|
||||
input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms.
|
||||
COMPILE_ASSERT(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples,
|
||||
audio_frame_too_small);
|
||||
static_assert(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples,
|
||||
"audio frame too small");
|
||||
memset(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() {
|
||||
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);
|
||||
codec_.pltype = kPayloadType;
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
|
||||
#include "testing/gmock/include/gmock/gmock.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/mock/mock_external_decoder_pcm16b.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 kJumpFromTimestamp = 7200;
|
||||
static const uint32_t kJumpToTimestamp = 2869342376;
|
||||
COMPILE_ASSERT(kJumpFromTimestamp < kJumpToTimestamp,
|
||||
timestamp_jump_should_not_result_in_wrap);
|
||||
COMPILE_ASSERT(
|
||||
static_assert(kJumpFromTimestamp < kJumpToTimestamp,
|
||||
"timestamp jump should not result in wrap");
|
||||
static_assert(
|
||||
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.
|
||||
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
|
||||
kStartSeqeunceNumber,
|
||||
@ -384,11 +383,11 @@ TEST_F(LargeTimestampJumpTest, JumpLongerThanHalfRangeAndWrap) {
|
||||
static const uint32_t kStartTimestamp = 3221223116;
|
||||
static const uint32_t kJumpFromTimestamp = 3221223216;
|
||||
static const uint32_t kJumpToTimestamp = 1073744278;
|
||||
COMPILE_ASSERT(kJumpToTimestamp < kJumpFromTimestamp,
|
||||
timestamp_jump_should_result_in_wrap);
|
||||
COMPILE_ASSERT(
|
||||
static_assert(kJumpToTimestamp < kJumpFromTimestamp,
|
||||
"timestamp jump should result in wrap");
|
||||
static_assert(
|
||||
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.
|
||||
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
|
||||
kStartSeqeunceNumber,
|
||||
@ -443,11 +442,11 @@ TEST_F(ShortTimestampJumpTest, JumpShorterThanHalfRange) {
|
||||
static const uint32_t kStartTimestamp = 4711;
|
||||
static const uint32_t kJumpFromTimestamp = 4811;
|
||||
static const uint32_t kJumpToTimestamp = 2147483747;
|
||||
COMPILE_ASSERT(kJumpFromTimestamp < kJumpToTimestamp,
|
||||
timestamp_jump_should_not_result_in_wrap);
|
||||
COMPILE_ASSERT(
|
||||
static_assert(kJumpFromTimestamp < kJumpToTimestamp,
|
||||
"timestamp jump should not result in wrap");
|
||||
static_assert(
|
||||
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.
|
||||
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
|
||||
kStartSeqeunceNumber,
|
||||
@ -467,11 +466,11 @@ TEST_F(ShortTimestampJumpTest, JumpShorterThanHalfRangeAndWrap) {
|
||||
static const uint32_t kStartTimestamp = 3221227827;
|
||||
static const uint32_t kJumpFromTimestamp = 3221227927;
|
||||
static const uint32_t kJumpToTimestamp = 1073739567;
|
||||
COMPILE_ASSERT(kJumpToTimestamp < kJumpFromTimestamp,
|
||||
timestamp_jump_should_result_in_wrap);
|
||||
COMPILE_ASSERT(
|
||||
static_assert(kJumpToTimestamp < kJumpFromTimestamp,
|
||||
"timestamp jump should result in wrap");
|
||||
static_assert(
|
||||
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.
|
||||
rtp_generator_.reset(new test::TimestampJumpRtpGenerator(samples_per_ms_,
|
||||
kStartSeqeunceNumber,
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/compile_assert.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/md5digest.h"
|
||||
#include "webrtc/base/stringencode.h"
|
||||
|
||||
Reference in New Issue
Block a user