Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
Cross compiling to windows using clang trips static asserts
- Dominant language
- C
- Stars
- 11.4k
- Forks
- 686
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 3
Description
```
$ clang nuklear.h -target x86_64-windows-gnu
nuklear.h:435:1: error: '_dummy_array435' declared as an array with a negative size
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nuklear.h:293:75: note: expanded from macro 'NK_STATIC_ASSERT'
#define NK_STATIC_ASSERT(exp) typedef char NK_UNIQUE_NAME(_dummy_array)[(exp)?1:-1]
^~~~~~~~~~
nuklear.h:436:1: error: '_dummy_array436' declared as an array with a negative size
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nuklear.h:293:75: note: expanded from macro 'NK_STATIC_ASSERT'
#define NK_STATIC_ASSERT(exp) typedef char NK_UNIQUE_NAME(_dummy_array)[(exp)?1:-1]
^~~~~~~~~~
2 errors generated.
```
Contributor guide
Research direction
Reproduce the failure with the shown clang command, then inspect nk_size, nk_ptr, and the NK_STATIC_ASSERT definition in nuklear.h. Determine why their size assertions fail for the x86_64-windows-gnu target; done means this command compiles without negative-size assertion errors while preserving the checks for other targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100