fix: correct int/int32_t pointer mismatches for -Wincompatible-pointer-types - #1657
Open
SomSamantray wants to merge 2 commits into
Open
fix: correct int/int32_t pointer mismatches for -Wincompatible-pointer-types#1657SomSamantray wants to merge 2 commits into
SomSamantray wants to merge 2 commits into
Conversation
…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.
Contributor
|
Drop the plan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On any target whose
stdint.hdefinesint32_taslong intrather thanint— every ESP-IDF/ESP32 chip since v5.0 —quickjs.cfails to compile under GCC 14+, because-Wincompatible-pointer-typesis now an error by default there. Six call sites across five local variables pass anint *where anint32_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'sv,js_parseInt'sradix,remainingElementsCount_add'sremainingElementsCount,js_promise_all_resolve_element'sindex, andjs_atomics_notify'scount) 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_tto a distinct-but-same-width type and compiling withclang -std=gnu11 -Werror=incompatible-pointer-typesreproduces 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-testpasses, and manually exercisedparseInt('ff', 16)andAtomics.notifyto confirm unchanged behavior.Fixes #1624