Files
flutter/engine/src/flutter
Jia Hao c2eecba786 [Impeller] Don't define CanvasRecorder if IMPELLER_TRACE_CANVAS is not set. (flutter/engine#46476)
Internal bug: b/303067268

https://github.com/flutter/engine/pull/46376 is causing a breakage to the internal engine build because of 543348a044/impeller/aiks/canvas_recorder.h (L58-L62). Internally, we do not set `IMPELLER_TRACE_CANVAS`.

It looks like the cause is that the internal toolchain causes the `static_assert` to be compiled even though the template is not instantiated.

@chingjun helped me to figure out the following:

https://stackoverflow.com/questions/5246049/c11-static-assert-and-template-instantiation points us to the spec. In the later version (ISO/IEC 14882:2017(E)):

> The program is ill-formed, no diagnostic required, if ... no valid specialization can be generated for a template or a substatement of a constexpr if statement (9.4.1) within a template and the template is not instantiated,

<details>

<summary>The relevant section</summary>

![The relevant section of the spec](https://github.com/flutter/engine/assets/7111741/4503efcd-9479-4c7a-b4a1-7302dea1653b)

</details>

Interpretation: the compiler can either choose to emit the error caused by the `static_assert` or not. Currently the compiler used by the build here on LUCI does not; internally it does.

For example, the following links shows that simply changing the Clang version affects whether the error appears or not for a minimal template.

- ok: https://godbolt.org/z/n9nYrcvcP
- not ok: https://godbolt.org/z/fWcvdcn35

Hence, `#ifdef` out the class instead of using a `static_assert` for more consistent behavior across these two toolchains.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-04 02:29:17 +00:00
..

Flutter Engine

OpenSSF Scorecard SLSA 1

Flutter is Google's SDK for crafting beautiful, fast user experiences for mobile, web, and desktop from a single codebase. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.

The Flutter Engine is a portable runtime for hosting Flutter applications. It implements Flutter's core libraries, including animation and graphics, file and network I/O, accessibility support, plugin architecture, and a Dart runtime and compile toolchain. Most developers will interact with Flutter via the Flutter Framework, which provides a modern, reactive framework, and a rich set of platform, layout and foundation widgets.

If you want to run/contribute to Flutter Web engine, more tooling can be found at felt. This is a tool written to make web engine development experience easy.

If you are new to Flutter, then you will find more general information on the Flutter project, including tutorials and samples, on our Web site at Flutter.dev. For specific information about Flutter's APIs, consider our API reference which can be found at the docs.flutter.dev.

Flutter is a fully open source project, and we welcome contributions. Information on how to get started can be found at our contributor guide.