jacob-carlborg / dstep

A tool for converting C and Objective-C headers to D modules
204 stars 37 forks source link

Rename enum members can create invalid enum names #278

Open helikopterodaktyl opened 2 years ago

helikopterodaktyl commented 2 years ago

Example when attempting to convert webgpu headers. Reproduced with dstep 1.0.3:

typedef enum WGPUTextureDimension { WGPUTextureDimension_1D = 0x00000000, WGPUTextureDimension_2D = 0x00000001, WGPUTextureDimension_3D = 0x00000002, WGPUTextureDimension_Force32 = 0x7FFFFFFF } WGPUTextureDimension;

with --rename-enum-members=true results in:

enum WGPUTextureDimension { 1d = 0x00000000, 2d = 0x00000001, 3d = 0x00000002, force32 = 0x7FFFFFFF }

enum names can't begin with a number. Perhaps _1d should be used instead in such case?

jacob-carlborg commented 2 years ago

Oh, yeah, that's a bug.