Commit Detail
Commit dddf7b5
Fix `JSG_TS_OVERRIDE` macro corruption from `<stdio.h>` macros
`JSG_TS_OVERRIDE`, `JSG_TS_DEFINE`, `JSG_STRUCT_TS_OVERRIDE`, and
`JSG_STRUCT_TS_DEFINE` previously stringified their varargs via
`JSG_STRING_LITERAL`, which is a two-step "stringify after macro
expansion" helper. When a containing variadic macro forwards
`__VA_ARGS__` into the helper, the preprocessor expands any
identifiers in the argument before stringification. On Darwin,
`<stdio.h>` defines `stdin`/`stdout`/`stderr` as
`__stdinp`/`__stdoutp`/`__stderrp`, so overrides like
`{ readonly stdin: WritableStream }` were stringified as
`"{ readonly __stdinp: WritableStream }"`, corrupting the generated
TypeScript on macOS builds.
Stringify directly with `#__VA_ARGS__` at the outermost macro that
captures the user's tokens. Document the hazard on `JSG_STRING_LITERAL`
and add a regression test in `rtti-test.c++`.
Files changed
3 files changed~3 modified