Move the COMPILE_ASSERT macro to its own header file.
TEST=n/a BUG=none Review URL: https://webrtc-codereview.appspot.com/492002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2001 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
e713fd0eee
commit
98ad0ff1b0
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 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
|
||||
@ -15,20 +15,14 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "compile_assert.h"
|
||||
|
||||
#include "modules/rtp_rtcp/source/rtp_format_vp8.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
template <bool>
|
||||
struct CompileAssert {
|
||||
};
|
||||
|
||||
#undef COMPILE_ASSERT
|
||||
#define COMPILE_ASSERT(expr, msg) \
|
||||
typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
|
||||
|
||||
class RtpFormatVp8Test : public ::testing::Test {
|
||||
protected:
|
||||
RtpFormatVp8Test() : helper_(NULL) {}
|
||||
|
27
src/system_wrappers/interface/compile_assert.h
Normal file
27
src/system_wrappers/interface/compile_assert.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_
|
||||
#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_
|
||||
|
||||
template <bool>
|
||||
struct CompileAssert {};
|
||||
|
||||
// Use this macro to verify at compile time that certain restrictions are met.
|
||||
// The first argument is the expression to evaluate, the second is a unique
|
||||
// identifier for the assert.
|
||||
// Example:
|
||||
// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
|
||||
#undef COMPILE_ASSERT
|
||||
#define COMPILE_ASSERT(expr, msg) \
|
||||
typedef CompileAssert<static_cast<bool>(expr)> \
|
||||
msg[static_cast<bool>(expr) ? 1 : -1]
|
||||
|
||||
#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_COMPILE_ASSERT_H_
|
@ -24,6 +24,7 @@
|
||||
'sources': [
|
||||
'../interface/aligned_malloc.h',
|
||||
'../interface/atomic32_wrapper.h',
|
||||
'../interface/compile_assert.h',
|
||||
'../interface/condition_variable_wrapper.h',
|
||||
'../interface/cpu_info.h',
|
||||
'../interface/cpu_wrapper.h',
|
||||
|
Loading…
x
Reference in New Issue
Block a user