Add RTC_ prefix to (D)CHECKs and related macros.

We must remove dependency on Chromium, i.e. we can't use Chromium's base/logging.h. That means we need to define these macros in WebRTC also when doing Chromium builds. And this causes redefinition.

Alternative solutions:
* Check if we already have defined e.g. CHECK, and don't define them in that case. This makes us depend on include order in Chromium, which is not acceptable.
* Don't allow using the macros in WebRTC headers. Error prone since if someone adds it there by mistake it may compile fine, but later break if a header in added or order is changed in Chromium. That will be confusing and hard to enforce.
* Ensure that headers that are included by an embedder don't include our macros. This would require some heavy refactoring to be maintainable and enforcable.
* Changes in Chromium for this is obviously not an option.

BUG=chromium:468375
NOTRY=true

Review URL: https://codereview.webrtc.org/1335923002

Cr-Commit-Position: refs/heads/master@{#9964}
This commit is contained in:
henrikg
2015-09-17 00:24:34 -07:00
committed by Commit bot
parent c0ac6cad00
commit 91d6edef35
232 changed files with 1665 additions and 1646 deletions

View File

@ -121,7 +121,7 @@ class Matrix {
const T* const* elements() const { return &elements_[0]; }
T Trace() {
CHECK_EQ(num_rows_, num_columns_);
RTC_CHECK_EQ(num_rows_, num_columns_);
T trace = 0;
for (int i = 0; i < num_rows_; ++i) {
@ -138,8 +138,8 @@ class Matrix {
}
Matrix& Transpose(const Matrix& operand) {
CHECK_EQ(operand.num_rows_, num_columns_);
CHECK_EQ(operand.num_columns_, num_rows_);
RTC_CHECK_EQ(operand.num_rows_, num_columns_);
RTC_CHECK_EQ(operand.num_columns_, num_rows_);
return Transpose(operand.elements());
}
@ -160,8 +160,8 @@ class Matrix {
}
Matrix& Add(const Matrix& operand) {
CHECK_EQ(num_rows_, operand.num_rows_);
CHECK_EQ(num_columns_, operand.num_columns_);
RTC_CHECK_EQ(num_rows_, operand.num_rows_);
RTC_CHECK_EQ(num_columns_, operand.num_columns_);
for (size_t i = 0; i < data_.size(); ++i) {
data_[i] += operand.data_[i];
@ -176,8 +176,8 @@ class Matrix {
}
Matrix& Subtract(const Matrix& operand) {
CHECK_EQ(num_rows_, operand.num_rows_);
CHECK_EQ(num_columns_, operand.num_columns_);
RTC_CHECK_EQ(num_rows_, operand.num_rows_);
RTC_CHECK_EQ(num_columns_, operand.num_columns_);
for (size_t i = 0; i < data_.size(); ++i) {
data_[i] -= operand.data_[i];
@ -192,8 +192,8 @@ class Matrix {
}
Matrix& PointwiseMultiply(const Matrix& operand) {
CHECK_EQ(num_rows_, operand.num_rows_);
CHECK_EQ(num_columns_, operand.num_columns_);
RTC_CHECK_EQ(num_rows_, operand.num_rows_);
RTC_CHECK_EQ(num_columns_, operand.num_columns_);
for (size_t i = 0; i < data_.size(); ++i) {
data_[i] *= operand.data_[i];
@ -208,8 +208,8 @@ class Matrix {
}
Matrix& PointwiseDivide(const Matrix& operand) {
CHECK_EQ(num_rows_, operand.num_rows_);
CHECK_EQ(num_columns_, operand.num_columns_);
RTC_CHECK_EQ(num_rows_, operand.num_rows_);
RTC_CHECK_EQ(num_columns_, operand.num_columns_);
for (size_t i = 0; i < data_.size(); ++i) {
data_[i] /= operand.data_[i];
@ -263,15 +263,15 @@ class Matrix {
}
Matrix& Multiply(const Matrix& lhs, const Matrix& rhs) {
CHECK_EQ(lhs.num_columns_, rhs.num_rows_);
CHECK_EQ(num_rows_, lhs.num_rows_);
CHECK_EQ(num_columns_, rhs.num_columns_);
RTC_CHECK_EQ(lhs.num_columns_, rhs.num_rows_);
RTC_CHECK_EQ(num_rows_, lhs.num_rows_);
RTC_CHECK_EQ(num_columns_, rhs.num_columns_);
return Multiply(lhs.elements(), rhs.num_rows_, rhs.elements());
}
Matrix& Multiply(const Matrix& rhs) {
CHECK_EQ(num_columns_, rhs.num_rows_);
RTC_CHECK_EQ(num_columns_, rhs.num_rows_);
CopyDataToScratch();
Resize(num_rows_, rhs.num_columns_);