From ab1ad742cb67399bdceefa0a1f7c5089e9fd5501 Mon Sep 17 00:00:00 2001 From: Huan Lin Date: Thu, 14 Nov 2024 12:15:46 -0800 Subject: [PATCH 1/3] [macos]fix clang-tidy warning for NSAssert --- .../darwin/macos/framework/Source/FlutterChannelKeyResponder.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm index 98abd505d4d9b..42de58c6ea943 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm @@ -134,6 +134,8 @@ - (void)handleEvent:(NSEvent*)event callback:(FlutterAsyncKeyCallback)callback { default: { NSAssert(false, @"Unexpected key event type (got %lu).", event.type); callback(false); + // This should not happen. Return to suppress clang-tidy warning on `type` being nil. + return; } } _previouslyPressedFlags = modifierFlags; From 4e6826f97b231a24559185462458e851437e4985 Mon Sep 17 00:00:00 2001 From: hellohuanlin <41930132+hellohuanlin@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:51:49 -0800 Subject: [PATCH 2/3] Update shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm Co-authored-by: Chris Bracken --- .../darwin/macos/framework/Source/FlutterChannelKeyResponder.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm index 42de58c6ea943..8af36f7195dc2 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm @@ -131,7 +131,7 @@ - (void)handleEvent:(NSEvent*)event callback:(FlutterAsyncKeyCallback)callback { return; } break; - default: { + default: [[unlikely]] { NSAssert(false, @"Unexpected key event type (got %lu).", event.type); callback(false); // This should not happen. Return to suppress clang-tidy warning on `type` being nil. From d447514bc53b3cd232a3d9715eb68d71e5e098c4 Mon Sep 17 00:00:00 2001 From: Huan Lin Date: Fri, 15 Nov 2024 11:12:59 -0800 Subject: [PATCH 3/3] format --- .../framework/Source/FlutterChannelKeyResponder.mm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm index 8af36f7195dc2..d3f1551533304 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm @@ -131,12 +131,13 @@ - (void)handleEvent:(NSEvent*)event callback:(FlutterAsyncKeyCallback)callback { return; } break; - default: [[unlikely]] { - NSAssert(false, @"Unexpected key event type (got %lu).", event.type); - callback(false); - // This should not happen. Return to suppress clang-tidy warning on `type` being nil. - return; - } + default: + [[unlikely]] { + NSAssert(false, @"Unexpected key event type (got %lu).", event.type); + callback(false); + // This should not happen. Return to suppress clang-tidy warning on `type` being nil. + return; + } } _previouslyPressedFlags = modifierFlags; NSMutableDictionary* keyMessage = [@{