Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5cba2ce

Browse files
Fix some warnings reported by recent versions of clang-tidy (#52349)
* Invalid enum values in the embedder library * Disable a check that warns about standard usage of GTK macros in the Linux embedder
1 parent 8578edf commit 5cba2ce

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

ci/licenses_golden/excluded_files

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@
371371
../../../flutter/shell/platform/glfw/client_wrapper/flutter_window_unittests.cc
372372
../../../flutter/shell/platform/glfw/client_wrapper/plugin_registrar_glfw_unittests.cc
373373
../../../flutter/shell/platform/glfw/client_wrapper/testing
374+
../../../flutter/shell/platform/linux/.clang-tidy
374375
../../../flutter/shell/platform/linux/testing
375376
../../../flutter/shell/platform/windows/README.md
376377
../../../flutter/shell/platform/windows/accessibility_bridge_windows_unittests.cc

shell/platform/embedder/embedder.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,8 @@ FlutterEngineResult FlutterEngineSendPointerEvent(
24572457
SAFE_ACCESS(current, signal_kind, kFlutterPointerSignalKindNone));
24582458
pointer_data.scroll_delta_x = SAFE_ACCESS(current, scroll_delta_x, 0.0);
24592459
pointer_data.scroll_delta_y = SAFE_ACCESS(current, scroll_delta_y, 0.0);
2460-
FlutterPointerDeviceKind device_kind = SAFE_ACCESS(current, device_kind, 0);
2460+
FlutterPointerDeviceKind device_kind =
2461+
SAFE_ACCESS(current, device_kind, kFlutterPointerDeviceKindMouse);
24612462
// For backwards compatibility with embedders written before the device
24622463
// kind and buttons were exposed, if the device kind is not set treat it
24632464
// as a mouse, with a synthesized primary button state based on the phase.

shell/platform/embedder/tests/embedder_unittests.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,6 +2337,7 @@ TEST_F(EmbedderTest, InvalidAOTDataSourcesMustReturnError) {
23372337
ASSERT_EQ(FlutterEngineCreateAOTData(&data_in, nullptr), kInvalidArguments);
23382338

23392339
// Invalid FlutterEngineAOTDataSourceType type specified.
2340+
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
23402341
data_in.type = static_cast<FlutterEngineAOTDataSourceType>(-1);
23412342
ASSERT_EQ(FlutterEngineCreateAOTData(&data_in, &data_out), kInvalidArguments);
23422343
ASSERT_EQ(data_out, nullptr);

shell/platform/linux/.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
InheritParentConfig: true
2+
3+
# EnumCastOutOfRange warns about some common usages of GTK macros
4+
Checks: >-
5+
-clang-analyzer-optin.core.EnumCastOutOfRange

0 commit comments

Comments
 (0)