[Mesa-dev] [Nine] 'meson: add -Werror=empty-body to disallow `if(x); `' - 'broke' Nine

Eric Engestrom eric.engestrom at intel.com
Thu Oct 24 22:39:35 UTC 2019


Indeed, Axel's solution is the right one: you can make it a `(void) something`
or `do {} while (0)` for instance.

Sorry for not catching this before landing my commit; I'll give it a look
tomorrow, tag me (@eric) if you send an MR before I get around to fixing it.


On Thursday, 2019-10-24 23:31:01 +0200, Axel Davy wrote:
> Hi Dieter,
> 
> Maybe the best fix would be to change the definition of WARN and DBG when
> DEBUG is disabled.
> 
> The definitions are in nine_debug.h
> 
> I haven't tried by maybe using "(void)" instead of nothing would work ?
> 
> Yours,
> 
> Axel
> 
> On 24/10/2019 16:34, Dieter Nützel wrote:
> > Hello Eric,
> > 
> > your mentioned commit (8d43e2b2ded0fe3c82d49561cdab9f208f9e64b6) broke
> > building with NIne (-Dgallium-nine=true) for me.
> > 
> > starting with
> > [-]
> > e_st at sta/cubetexture9.c.o' -c
> > ../src/gallium/state_trackers/nine/cubetexture9.c
> > ../src/gallium/state_trackers/nine/cubetexture9.c: In function
> > ‘NineCubeTexture9_ctor’:
> > ../src/gallium/state_trackers/nine/cubetexture9.c:108:43: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >   108 |             "but this is unimplemented\n");
> >       |                                           ^
> > cc1: some warnings being treated as errors
> > 
> > -- 
> > Next
> > 
> > /surface9.c.o' -c ../src/gallium/state_trackers/nine/surface9.c
> > ../src/gallium/state_trackers/nine/surface9.c: In function
> > ‘NineSurface9_GetContainer’:
> > ../src/gallium/state_trackers/nine/surface9.c:334:40: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >   334 |         DBG("QueryInterface FAILED!\n");
> >       |                                        ^
> > cc1: some warnings being treated as errors
> > 
> > -- 
> > 
> > @sta/swapchain9.c.o' -c ../src/gallium/state_trackers/nine/swapchain9.c
> > ../src/gallium/state_trackers/nine/swapchain9.c: In function ‘present’:
> > ../src/gallium/state_trackers/nine/swapchain9.c:737:51: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >   737 |             pSourceRect->top, pSourceRect->bottom);
> >       |                                                   ^
> > ../src/gallium/state_trackers/nine/swapchain9.c:741:47: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >   741 |             pDestRect->top, pDestRect->bottom);
> >       |                                               ^
> > cc1: some warnings being treated as errors
> > 
> > -- 
> > 
> > evice9.c.o' -c ../src/gallium/state_trackers/nine/device9.c
> > ../src/gallium/state_trackers/nine/device9.c: In function
> > ‘NineDevice9_ctor’:
> > ../src/gallium/state_trackers/nine/device9.c:296:49: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >   296 |         DBG("\033[1;32mCSMT is active\033[0m\n");
> >       |                                                 ^
> > ../src/gallium/state_trackers/nine/device9.c: In function
> > ‘create_zs_or_rt_surface’:
> > ../src/gallium/state_trackers/nine/device9.c:1221:87: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1221 |       DBG("FIXME Used shared handle! This option isn't probably
> > handled correctly!\n");
> > |                      ^
> > ../src/gallium/state_trackers/nine/device9.c: In function
> > ‘NineDevice9_UpdateSurface’:
> > ../src/gallium/state_trackers/nine/device9.c:1307:53: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1307 |             pSourceRect->right, pSourceRect->bottom);
> >       |                                                     ^
> > ../src/gallium/state_trackers/nine/device9.c:1309:68: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1309 |         DBG("pDestPoint = (%u,%u)\n", pDestPoint->x,
> > pDestPoint->y);
> > |   ^
> > ../src/gallium/state_trackers/nine/device9.c: In function
> > ‘NineDevice9_StretchRect’:
> > ../src/gallium/state_trackers/nine/device9.c:1588:53: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1588 |             pSourceRect->right, pSourceRect->bottom);
> >       |                                                     ^
> > ../src/gallium/state_trackers/nine/device9.c:1591:49: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1591 |             pDestRect->right, pDestRect->bottom);
> >       |                                                 ^
> > ../src/gallium/state_trackers/nine/device9.c: In function
> > ‘NineDevice9_ColorFill’:
> > ../src/gallium/state_trackers/nine/device9.c:1786:41: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1786 |             pRect->right, pRect->bottom);
> >       |                                         ^
> > ../src/gallium/state_trackers/nine/device9.c: In function
> > ‘NineDevice9_CreateOffscreenPlainSurface’:
> > ../src/gallium/state_trackers/nine/device9.c:1864:43: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1864 |         DBG("Failed to create surface.\n");
> >       |                                           ^
> > cc1: some warnings being treated as errors
> > 
> > -- 
> > 
> > st at sta/nine_shader.c.o' -c
> > ../src/gallium/state_trackers/nine/nine_shader.c
> > ../src/gallium/state_trackers/nine/nine_shader.c: In function
> > ‘tx_dst_param_as_src’:
> > ../src/gallium/state_trackers/nine/nine_shader.c:1437:52: error: suggest
> > braces around empty body in an ‘if’ statement [-Werror=empty-body]
> >  1437 |         WARN("mask is 0, using identity swizzle\n");
> >       |
> > 
> > -- 
> > Last
> > 
> > ine_ff.c.o' -c ../src/gallium/state_trackers/nine/nine_ff.c
> > ../src/gallium/state_trackers/nine/nine_ff.c: In function
> > ‘nine_ff_get_vs’:
> > ../src/gallium/state_trackers/nine/nine_ff.c:1610:72: error: suggest
> > braces around empty body in an ‘else’ statement [-Werror=empty-body]
> >  1610 |                     DBG("FF given texture coordinate >= 8.
> > Ignoring\n");
> > |       ^
> > cc1: some warnings being treated as errors
> > 
> > Thanks,
> > Dieter
> > 
> 


More information about the mesa-dev mailing list