dotnet / dotnet/ClangSharp

Value-like macro using `UINT64_MAX` generates `nuint` type incorrectly on Unix

Open
#835 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.3k
Forks
187
Avg merge
6d 19h
Merged PRs (30d)
1

Description

https://github.com/dotnet/ClangSharp/pull/757 seems to not have fixed the following case:
```c
#include
#define B3_DEFAULT_CATEGORY_BITS UINT64_MAX
#define B3_DEFAULT_MASK_BITS UINT64_MAX
```
with `-g macro-bindings`, this generates
```cs
[NativeTypeName("#define B3_DEFAULT_CATEGORY_BITS UINT64_MAX")]
public const ulong B3_DEFAULT_CATEGORY_BITS = 0xffffffffffffffffUL;

[NativeTypeName("#define B3_DEFAULT_MASK_BITS UINT64_MAX")]
public const ulong B3_DEFAULT_MASK_BITS = 0xffffffffffffffffUL;
```
on Windows but `nuint` type on Unix.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the shown C snippet with `-g macro-bindings` on Unix and compare its generated bindings with the Windows output. Start by reviewing PR 757 and tracing the macro type inference for `UINT64_MAX`; done means these value-like macros no longer generate `nuint` incorrectly on Unix.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, csharp
Domain
compilers, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.