[Mesa-dev] [PATCH mesa] egl: turn a couple asserts static (compile-time)
Emil Velikov
emil.l.velikov at gmail.com
Wed Aug 24 11:11:23 UTC 2016
On 22 August 2016 at 21:52, Eric Engestrom <eric at engestrom.ch> wrote:
> Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> ---
> src/egl/main/eglconfig.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
> index 435d924..6161d26 100644
> --- a/src/egl/main/eglconfig.c
> +++ b/src/egl/main/eglconfig.c
> @@ -38,6 +38,7 @@
> #include <assert.h>
> #include "c99_compat.h"
>
> +#include "eglcompiler.h"
> #include "eglconfig.h"
> #include "egldisplay.h"
> #include "eglcurrent.h"
> @@ -598,14 +599,14 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
> return 0;
>
> /* the enum values have the desired ordering */
> - assert(EGL_NONE < EGL_SLOW_CONFIG);
> - assert(EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
> + STATIC_ASSERT(EGL_NONE < EGL_SLOW_CONFIG);
> + STATIC_ASSERT(EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
> val1 = conf1->ConfigCaveat - conf2->ConfigCaveat;
> if (val1)
> return val1;
>
> /* the enum values have the desired ordering */
> - assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
> + STATIC_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
Realistically neither one of these can be false since that means that
the EGL ABI is completely broken.
Then again having a quick (build time) sanity check doesn't hurt, so
I've pulled this in master.
Btw I've commented and/or pushed any of your outstanding patches.
Thanks !
Emil
More information about the mesa-dev
mailing list