ImportC: improve error message for size_t (#21187)

Resolves: https://github.com/dlang/dmd/issues/20414

Add some hints for common missing includes.
This commit is contained in:
drpriver 2025-04-09 16:16:54 -07:00 committed by GitHub
parent ca2f90d1fc
commit 74cdfed9d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 83 additions and 21 deletions

View file

@ -0,0 +1,15 @@
/* TEST_OUTPUT:
---
fail_compilation/test20414.c(1): Error: `size_t` is not defined, perhaps `#include <stddef.h>` ?
fail_compilation/test20414.c(2): Error: `ptrdiff_t` is not defined, perhaps `#include <stddef.h>` ?
fail_compilation/test20414.c(3): Error: `NULL` is not defined, perhaps `#include <stddef.h>` is needed?
fail_compilation/test20414.c(5): Error: undefined identifier `fooo`, did you mean function `foo`?
---
*/
#line 1
size_t x;
ptrdiff_t pd;
void *p = NULL;
void foo(void);
void (*fp)(void) = &fooo;