-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nullability attributes need some love #190
Comments
https://bugs.webkit.org/show_bug.cgi?id=257675 rdar://110202947 Reviewed by NOBODY (OOPS!). WebGPU.h already has macros to specify nullability. This patch hooks them up to the appropriate clang attributes. WebGPU.h's macros don't work out of the box; I opened webgpu-native/webgpu-headers#190 about fixing the problems with it. * Source/WebCore/PAL/Configurations/PAL.xcconfig: * Source/WebGPU/Configurations/Base.xcconfig: * Source/WebGPU/Configurations/WebGPU.xcconfig: * Source/WebGPU/WebGPU/Instance.mm: (wgpuInstanceRequestAdapter): * Source/WebGPU/WebGPU/WebGPU.h:
Since we're generating the header anyway I kind of prefer annotating everything. It's noisy but I think it's better than having to go learn the rules about exactly what is and isn't affected by assume_nonnull... |
Nullability attributes are broken so they can't be used at all right now. It is quite a bit of work to get them fully working so I would like to declare this |
This is basically the same as the |
Dec 12 meeting:
|
I had to make quite a bit of changes to make the nullability attributes actually compile. I eventually got them to work in https://github.com/WebKit/WebKit/pull/14652/files#diff-1a3f28db146a69a5330a62cca964426d2794d35086c2d2e9f9a23e493a54d433
char const * WGPU_NULLABLE label;
Wrong:WGPU_NULLABLE char const * label;
_Pragma("clang assume_nonnull begin")
and_Pragma("clang assume_nonnull end")
so you don't have to annotate literally everythingassume_nonnull
, there are still some places that need an explicitWGPU_NONNULL
. I don't quite understand why. The docs say "More complex pointer types ... must be explicitly annotated."wgpuAdapterEnumerateFeatures()
andwgpuDeviceEnumerateFeatures()
need to have their argument be nullable. These functions are designed to be called twice: once to let the caller know how much storage to allocate, and then a second time with the actual store. That first call needs to support nullptr.On the upside, though, after getting these attributes to compile, they found 2 real bugs in our implementation!
Original issue: #119
EDIT(kainino0x): adding onto that list from #182 (review) and others:
wgpuCreateInstance()
)The text was updated successfully, but these errors were encountered: