Skip to content

backends/native: Declare variables at beginning of block

Carlos Garnacho requested to merge carlosg/mutter:wip/clang-build-fix into main

In consistence with the code style, and in order to fix build errors with older clang:

../src/backends/native/meta-onscreen-native.c:521:7: error: expected expression
  521 |       graphene_rect_t src_rect;
      |       ^
../src/backends/native/meta-onscreen-native.c:529:39: error: use of undeclared identifier 'src_rect'; did you mean 'dst_rect'?
  529 |                                      &src_rect);
      |                                       ^~~~~~~~
      |                                       dst_rect
../src/backends/native/meta-onscreen-native.c:522:20: note: 'dst_rect' declared here
  522 |       MtkRectangle dst_rect;
      |                    ^

And warnings with newer clang:

../src/backends/native/meta-onscreen-native.c:521:7: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
  521 |       graphene_rect_t src_rect;
      |       ^

This should allow the build for coverity to succeed again.

Fixes: adc776d0 ("crtc/kms: Pass on src and dst rects to primary plane assignments")

Merge request reports