Skip to content

fix: correct int/int32_t pointer mismatches for -Wincompatible-pointer-types - #1657

Open
SomSamantray wants to merge 2 commits into
quickjs-ng:masterfrom
SomSamantray:fix/int32-pointer-mismatch
Open

fix: correct int/int32_t pointer mismatches for -Wincompatible-pointer-types#1657
SomSamantray wants to merge 2 commits into
quickjs-ng:masterfrom
SomSamantray:fix/int32-pointer-mismatch

Conversation

@SomSamantray

Copy link
Copy Markdown

On any target whose stdint.h defines int32_t as long int rather than int — every ESP-IDF/ESP32 chip since v5.0 — quickjs.c fails to compile under GCC 14+, because -Wincompatible-pointer-types is now an error by default there. Six call sites across five local variables pass an int * where an int32_t * is expected, or the reverse.

Both types are 32-bit signed on every platform this project targets, so there's no behavioral difference — this retypes the five local variables (find_line_num's v, js_parseInt's radix, remainingElementsCount_add's remainingElementsCount, js_promise_all_resolve_element's index, and js_atomics_notify's count) to match the callee signature each is already used against everywhere else in the file. No callee signatures changed.

Verified locally without ESP32 hardware or a GCC 14 install: shimming int32_t to a distinct-but-same-width type and compiling with clang -std=gnu11 -Werror=incompatible-pointer-types reproduces the exact 6 errors at the exact reported lines before the fix, and compiles clean after. Also confirmed the normal (unshimmed) build still succeeds, api-test passes, and manually exercised parseInt('ff', 16) and Atomics.notify to confirm unchanged behavior.

Fixes #1624


Compound Engineering

…r-types

Six call sites pass an int* where int32_t* is expected (or the
reverse) in find_line_num, js_parseInt, remainingElementsCount_add,
js_promise_all_resolve_element, and js_atomics_notify. Both types are
32-bit signed everywhere this project targets, so there is no
behavioral change, but on any target where stdint.h defines int32_t
as long int (ESP-IDF/ESP32 since v5.0), GCC 14+ treats the mismatch
as a hard -Wincompatible-pointer-types error and the file fails to
build. Retype the five local variables to match the callee signature
already used at every other call site.
@saghul

saghul commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Drop the plan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quickjs.c fails to compile on targets where int32_t is long int (ESP-IDF / bare-metal newlib): -Wincompatible-pointer-types

2 participants