Commit bb7534ee by Yuly Novikov Committed by Commit Bot

Use ASSERT() instead of assert() when possible.

Since ASSERT() works in Release builds. Left assert() in a few places where calling a function may not be safe. Bug: angleproject:4396 Change-Id: Ic75a3d41d846e327097f8c37fe2336dcd3be6cb8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057745Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent 9f4ab98d
......@@ -8,7 +8,7 @@
#include "common/tls.h"
#include <assert.h>
#include "common/debug.h"
#ifdef ANGLE_ENABLE_WINDOWS_UWP
# include <map>
......@@ -62,14 +62,14 @@ TLSIndex CreateTLSIndex()
}
#endif
assert(index != TLS_INVALID_INDEX &&
ASSERT(index != TLS_INVALID_INDEX &&
"CreateTLSIndex(): Unable to allocate Thread Local Storage");
return index;
}
bool DestroyTLSIndex(TLSIndex index)
{
assert(index != TLS_INVALID_INDEX && "DestroyTLSIndex(): Invalid TLS Index");
ASSERT(index != TLS_INVALID_INDEX && "DestroyTLSIndex(): Invalid TLS Index");
if (index == TLS_INVALID_INDEX)
{
return false;
......@@ -77,8 +77,8 @@ bool DestroyTLSIndex(TLSIndex index)
#ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_UWP
assert(index < nextTlsIndex);
assert(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end());
ASSERT(index < nextTlsIndex);
ASSERT(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end());
freeTlsIndices.push_back(index);
for (auto threadData : allThreadData)
......@@ -99,7 +99,7 @@ bool DestroyTLSIndex(TLSIndex index)
bool SetTLSValue(TLSIndex index, void *value)
{
assert(index != TLS_INVALID_INDEX && "SetTLSValue(): Invalid TLS Index");
ASSERT(index != TLS_INVALID_INDEX && "SetTLSValue(): Invalid TLS Index");
if (index == TLS_INVALID_INDEX)
{
return false;
......@@ -131,7 +131,7 @@ bool SetTLSValue(TLSIndex index, void *value)
void *GetTLSValue(TLSIndex index)
{
assert(index != TLS_INVALID_INDEX && "GetTLSValue(): Invalid TLS Index");
ASSERT(index != TLS_INVALID_INDEX && "GetTLSValue(): Invalid TLS Index");
if (index == TLS_INVALID_INDEX)
{
return nullptr;
......
......@@ -276,7 +276,7 @@ inline bool IsIntegerSampler(TBasicType type)
case EbtSamplerVideoWEBGL:
return false;
default:
assert(!IsSampler(type));
ASSERT(!IsSampler(type));
}
return false;
......@@ -311,7 +311,7 @@ inline bool IsIntegerSamplerUnsigned(TBasicType type)
case EbtUSamplerCubeArray:
return true;
default:
assert(!IsIntegerSampler(type));
ASSERT(!IsIntegerSampler(type));
}
return false;
......@@ -469,7 +469,7 @@ inline bool IsSampler2D(TBasicType type)
case EbtUSamplerCubeArray:
return false;
default:
assert(!IsSampler(type));
ASSERT(!IsSampler(type));
}
return false;
......@@ -525,7 +525,7 @@ inline bool IsSamplerCube(TBasicType type)
case EbtSamplerVideoWEBGL:
return false;
default:
assert(!IsSampler(type));
ASSERT(!IsSampler(type));
}
return false;
......@@ -581,7 +581,7 @@ inline bool IsSampler3D(TBasicType type)
case EbtSamplerVideoWEBGL:
return false;
default:
assert(!IsSampler(type));
ASSERT(!IsSampler(type));
}
return false;
......@@ -637,7 +637,7 @@ inline bool IsSamplerArray(TBasicType type)
case EbtSamplerVideoWEBGL:
return false;
default:
assert(!IsSampler(type));
ASSERT(!IsSampler(type));
}
return false;
......@@ -693,7 +693,7 @@ inline bool IsShadowSampler(TBasicType type)
case EbtSamplerVideoWEBGL:
return false;
default:
assert(!IsSampler(type));
ASSERT(!IsSampler(type));
}
return false;
......@@ -742,7 +742,7 @@ inline bool IsImage2D(TBasicType type)
case EbtUImageBuffer:
return false;
default:
assert(!IsImage(type));
ASSERT(!IsImage(type));
}
return false;
......@@ -791,7 +791,7 @@ inline bool IsImage3D(TBasicType type)
case EbtUImageBuffer:
return false;
default:
assert(!IsImage(type));
ASSERT(!IsImage(type));
}
return false;
......@@ -840,7 +840,7 @@ inline bool IsImage2DArray(TBasicType type)
case EbtUImageBuffer:
return false;
default:
assert(!IsImage(type));
ASSERT(!IsImage(type));
}
return false;
......@@ -889,7 +889,7 @@ inline bool IsImageCube(TBasicType type)
case EbtUImageBuffer:
return false;
default:
assert(!IsImage(type));
ASSERT(!IsImage(type));
}
return false;
......
......@@ -7,8 +7,6 @@
#ifndef COMPILER_TRANSLATOR_CONSTANTUNION_H_
#define COMPILER_TRANSLATOR_CONSTANTUNION_H_
#include <assert.h>
#include "compiler/translator/BaseTypes.h"
#include "compiler/translator/Common.h"
......
......@@ -6,14 +6,14 @@
#include "compiler/translator/PoolAlloc.h"
#include <assert.h>
#include "common/debug.h"
#include "common/tls.h"
TLSIndex PoolIndex = TLS_INVALID_INDEX;
bool InitializePoolIndex()
{
assert(PoolIndex == TLS_INVALID_INDEX);
ASSERT(PoolIndex == TLS_INVALID_INDEX);
PoolIndex = CreateTLSIndex();
return PoolIndex != TLS_INVALID_INDEX;
......@@ -21,7 +21,7 @@ bool InitializePoolIndex()
void FreePoolIndex()
{
assert(PoolIndex != TLS_INVALID_INDEX);
ASSERT(PoolIndex != TLS_INVALID_INDEX);
DestroyTLSIndex(PoolIndex);
PoolIndex = TLS_INVALID_INDEX;
......@@ -29,12 +29,12 @@ void FreePoolIndex()
angle::PoolAllocator *GetGlobalPoolAllocator()
{
assert(PoolIndex != TLS_INVALID_INDEX);
ASSERT(PoolIndex != TLS_INVALID_INDEX);
return static_cast<angle::PoolAllocator *>(GetTLSValue(PoolIndex));
}
void SetGlobalPoolAllocator(angle::PoolAllocator *poolAllocator)
{
assert(PoolIndex != TLS_INVALID_INDEX);
ASSERT(PoolIndex != TLS_INVALID_INDEX);
SetTLSValue(PoolIndex, poolAllocator);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment