Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ - (CVPixelBufferRef)pixelBuffer {
CVPixelBufferRef pxbuffer = NULL;
CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, _width, _width, _pixelFormatType,
(__bridge CFDictionaryRef)options, &pxbuffer);
NSAssert(status == kCVReturnSuccess && pxbuffer != NULL, @"Failed to create pixel buffer.");
FML_DCHECK(status == kCVReturnSuccess && pxbuffer != nullptr) << "Failed to create pixel buffer";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Value stored to 'status' during its initialization is never read"

/Volumes/Work/s/w/ir/cache/builder/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterEmbedderExternalTextureTest.mm:60:12: error: Value stored to 'status' during its initialization is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
   60 |   CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, _width, _width, _pixelFormatType,
      |            ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   61 |                                         (__bridge CFDictionaryRef)options, &pxbuffer);
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hmm, why would this be happening with the FML_DCHECK since, as you point out, it shouldn't cause unused variable warnings?
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8746648441899682977/+/u/test:_test:_lint_host_debug/stdout

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'll try to run clang-tidy locally to check if there are any problems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added another comment w.r.t. the advantages of FML_DCHECK over NSAssert in the context of the Flutter engine codebase. Link to the comment

return pxbuffer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ static uint64_t GetLogicalKeyForEvent(NSEvent* event, uint64_t physicalKey) {
uint32_t* keyLabel = DecodeUtf16(keyLabelUtf16, &keyLabelLength);
if (keyLabelLength == 1) {
uint32_t keyLabelChar = *keyLabel;
NSCAssert(!IsControlCharacter(keyLabelChar) && !IsUnprintableKey(keyLabelChar),
@"Unexpected control or unprintable keylabel 0x%x", keyLabelChar);
NSCAssert(keyLabelChar <= 0x10FFFF, @"Out of range keylabel 0x%x", keyLabelChar);
FML_DCHECK(!IsControlCharacter(keyLabelChar) && !IsUnprintableKey(keyLabelChar))
<< "Unexpected control or unprintable keylabel 0x" << std::hex << keyLabelChar;
FML_DCHECK(keyLabelChar <= 0x10FFFF)
<< "Out of range keylabel 0x" << std::hex << keyLabelChar;
character = keyLabelChar;
}
delete[] keyLabel;
Expand Down