Fix use of nested designators (flutter/engine#45869)

There was an internal global change which turned `-Wc99-designator`. This causes the following error:

```
error: nested designators are a C99 extension [-Werror,-Wc99-designator]
   65 |       .metal.struct_size = sizeof(FlutterMetalRendererConfig),
      |       ^~~~~~~~~~~~~~~~~~
```

This seems like a trivial (?) fix, so perhaps we can fix it properly and possibly remove b9fbd310d6/build/config/compiler/BUILD.gn (L667) after this PR lands.

*List which issues are fixed by this PR. You must list at least one issue.*

b/300573112

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Jia Hao
2023-10-19 18:37:32 +00:00
committed by GitHub
parent e559ceb0ac
commit 0e87f9611e

View File

@@ -62,16 +62,17 @@ static bool OnAcquireExternalTexture(FlutterEngine* engine,
- (FlutterRendererConfig)createRendererConfig {
FlutterRendererConfig config = {
.type = FlutterRendererType::kMetal,
.metal.struct_size = sizeof(FlutterMetalRendererConfig),
.metal.device = (__bridge FlutterMetalDeviceHandle)_device,
.metal.present_command_queue = (__bridge FlutterMetalCommandQueueHandle)_commandQueue,
.metal.get_next_drawable_callback =
reinterpret_cast<FlutterMetalTextureCallback>(OnGetNextDrawable),
.metal.present_drawable_callback =
reinterpret_cast<FlutterMetalPresentCallback>(OnPresentDrawable),
.metal.external_texture_frame_callback =
reinterpret_cast<FlutterMetalTextureFrameCallback>(OnAcquireExternalTexture),
};
.metal = {
.struct_size = sizeof(FlutterMetalRendererConfig),
.device = (__bridge FlutterMetalDeviceHandle)_device,
.present_command_queue = (__bridge FlutterMetalCommandQueueHandle)_commandQueue,
.get_next_drawable_callback =
reinterpret_cast<FlutterMetalTextureCallback>(OnGetNextDrawable),
.present_drawable_callback =
reinterpret_cast<FlutterMetalPresentCallback>(OnPresentDrawable),
.external_texture_frame_callback =
reinterpret_cast<FlutterMetalTextureFrameCallback>(OnAcquireExternalTexture),
}};
return config;
}