pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
www/elinks build failure on hppa - patch fix included
Opened upstream:
https://github.com/rkd77/elinks/issues/439
src/js/quickjs/window.c fails to compile on 32-bit platforms where
intptr_t is typedef'd as long rather than int (NetBSD does this
on several ports, including hppa).
In js_window_clearInterval() and js_window_clearTimeout(), the SIZEOF_INTPTR_T == 4 branch passes
&number (an intptr_t*) directly to JS_ToInt32(), which requires an
int32_t*.
On platforms where intptr_t is long, this is a genuine
type mismatch (-Wincompatible-pointer-types), even though both types
are the same width:
../src/js/quickjs/window.c:380:29: error: passing argument 2 of
'JS_ToInt32' from incompatible pointer type
380 | if (JS_ToInt32(ctx, &number, argv[0])) {
| ^~~~~~~
quickjs.h:721:41: note: expected 'int32_t *' but argument is of
type 'intptr_t *' {aka 'long int *’}
This built fine on Linux and on NetBSD/sparc32 (where intptr_t
happens to be int), but fails on NetBSD/hppa where intptr_t is
long.
$NetBSD$
Fix build where intptr_t is not the same underlying type as int32_t
(e.g. NetBSD/hppa, where intptr_t is long even though it's 32-bit).
JS_ToInt32() requires an int32_t*, so pass it a proper int32_t and
copy the result into the intptr_t afterward.
--- src/js/quickjs/window.c.orig 2026-08-17 22:25:19.140798360 +0000
+++ src/js/quickjs/window.c
@@ -377,9 +377,11 @@ js_window_clearInterval(JSContext *ctx, JSValueConst t
intptr_t number;
#if SIZEOF_INTPTR_T == 4
- if (JS_ToInt32(ctx, &number, argv[0])) {
+ int32_t number32;
+ if (JS_ToInt32(ctx, &number32, argv[0])) {
return JS_UNDEFINED;
}
+ number = number32;
#else
if (JS_ToInt64(ctx, &number, argv[0])) {
return JS_UNDEFINED;
@@ -413,9 +415,11 @@ js_window_clearTimeout(JSContext *ctx, JSValueConst th
intptr_t number;
#if SIZEOF_INTPTR_T == 4
- if (JS_ToInt32(ctx, &number, argv[0])) {
+ int32_t number32;
+ if (JS_ToInt32(ctx, &number32, argv[0])) {
return JS_UNDEFINED;
}
+ number = number32;
#else
if (JS_ToInt64(ctx, &number, argv[0])) {
return JS_UNDEFINED;
Home |
Main Index |
Thread Index |
Old Index