Use static_assert instead of meta macros. Change-Id: Id1e3a50d56475c495a3cfb82553c5bd4c48a0fc3 Reviewed-on: https://swiftshader-review.googlesource.com/5425 Reviewed-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com> Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/common/debug.h b/src/OpenGL/common/debug.h index dc8ea98..bbf7521 100644 --- a/src/OpenGL/common/debug.h +++ b/src/OpenGL/common/debug.h
@@ -90,7 +90,4 @@ #endif // __ANDROID__ -// A macro functioning as a compile-time assert to validate constant conditions -#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition) ? 1 : -1] - #endif // COMMON_DEBUG_H_
diff --git a/src/OpenGL/libEGL/Config.cpp b/src/OpenGL/libEGL/Config.cpp index 9a5839e..835b198 100644 --- a/src/OpenGL/libEGL/Config.cpp +++ b/src/OpenGL/libEGL/Config.cpp
@@ -211,10 +211,10 @@ return x.attribute < y.attribute; \ } - META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); + static_assert(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG, ""); SORT_SMALLER(mConfigCaveat); - META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); + static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, ""); SORT_SMALLER(mColorBufferType); SORT_SMALLER(mRedSize); @@ -300,10 +300,10 @@ return x->attribute < y->attribute; \ } - META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); + static_assert(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG, ""); SORT_SMALLER(mConfigCaveat); - META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); + static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, ""); SORT_SMALLER(mColorBufferType); // By larger total number of color bits, only considering those that are requested to be > 0.
diff --git a/src/OpenGL/libGLES_CM/libGLES_CM.cbp b/src/OpenGL/libGLES_CM/libGLES_CM.cbp index 770fe95..a35b6f8 100644 --- a/src/OpenGL/libGLES_CM/libGLES_CM.cbp +++ b/src/OpenGL/libGLES_CM/libGLES_CM.cbp
@@ -152,7 +152,6 @@ <Unit filename="../../Common/Math.hpp" /> <Unit filename="../../Common/Memory.cpp" /> <Unit filename="../../Common/Memory.hpp" /> - <Unit filename="../../Common/MetaMacro.hpp" /> <Unit filename="../../Common/MutexLock.hpp" /> <Unit filename="../../Common/Resource.cpp" /> <Unit filename="../../Common/Resource.hpp" />
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cbp b/src/OpenGL/libGLESv2/libGLESv2.cbp index 980889b..e4ea4a4 100644 --- a/src/OpenGL/libGLESv2/libGLESv2.cbp +++ b/src/OpenGL/libGLESv2/libGLESv2.cbp
@@ -151,7 +151,6 @@ <Unit filename="../../Common/Math.hpp" /> <Unit filename="../../Common/Memory.cpp" /> <Unit filename="../../Common/Memory.hpp" /> - <Unit filename="../../Common/MetaMacro.hpp" /> <Unit filename="../../Common/MutexLock.hpp" /> <Unit filename="../../Common/Resource.cpp" /> <Unit filename="../../Common/Resource.hpp" />