-
Notifications
You must be signed in to change notification settings - Fork 373
C-style enum sentinel is broken #458
Copy link
Copy link
Closed
Labels
Description
language = "C"
[enum]
add_sentinel = trueEnds up generating the following enums:
enum WGPUBindingType {
WGPUBindingType_UniformBuffer = 0,
WGPUBindingType_StorageBuffer = 1,
WGPUBindingType_ReadonlyStorageBuffer = 2,
WGPUBindingType_Sampler = 3,
WGPUBindingType_SampledTexture = 4,
WGPUBindingType_StorageTexture = 5,
Sentinel /* this must be last for serialization purposes. */
};Problem is that, since these are not enum classes, Sentinel becomes visible everywhere and collides with any other enum right away:
0:26.45 /mnt/code/firefox/obj-x86_64-pc-linux-gnu/dist/include/mozilla/webgpu/ffi/wgpu_ffi_generated.h:52:3: error: redefinition of enumerator 'Sentinel'
0:26.45 Sentinel /* this must be last for serialization purposes. */
0:26.45 ^
0:26.45 /mnt/code/firefox/obj-x86_64-pc-linux-gnu/dist/include/mozilla/webgpu/ffi/wgpu_ffi_generated.h:43:3: note: previous definition is here
0:26.45 Sentinel /* this must be last for serialization purposes. */
0:26.45
We need to either add the prefix to it automatically (e.g. WGPUBindingType_Sentinel_ - would be my preference), or allow the user to control the name.
Reactions are currently unavailable