Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Build failure with gcc 14 #194

Open
vvolkl opened this issue May 15, 2024 · 1 comment
Open

Build failure with gcc 14 #194

vvolkl opened this issue May 15, 2024 · 1 comment

Comments

@vvolkl
Copy link

vvolkl commented May 15, 2024

On a x86_64 machine running Fedora 40, I see the following compilation error:

gcc -o Linux_All_DBG.OBJ/jsapi.o -c -fPIC -DHAVE_VA_COPY -DVA_COPY=__va_copy -Wall -Wno-format -g -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DHAVE_LOCALTIME_R -DHAVE_VA_COPY -DVA_COPY=va_copy -DPIC -fPIC -DDEBUG -DDEBUG_ -DEDITLINE -ILinux_All_DBG.OBJ  jsapi.c
<command-line>: warning: "VA_COPY" redefined
<command-line>: note: this is the location of the previous definition
In file included from /usr/include/ctype.h:25,
                 from jsapi.c:45:
/usr/include/features.h:196:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  196 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
jsapi.c: In function ‘JS_ConvertArgumentsVA’:
jsapi.c:273:39: error: implicit declaration of function ‘JS_ADDRESSOF_VA_LIST’ [-Wimplicit-function-declaration]
  273 |                                       JS_ADDRESSOF_VA_LIST(ap))) {
      |                                       ^~~~~~~~~~~~~~~~~~~~
jsapi.c:273:39: error: passing argument 5 of ‘TryArgumentFormatter’ makes pointer from integer without a cast [-Wint-conversion]
  273 |                                       JS_ADDRESSOF_VA_LIST(ap))) {
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                       |
      |                                       int
jsapi.c:143:44: note: expected ‘__va_list_tag (*)[1]’ but argument is of type ‘int’
  143 |                      jsval **vpp, va_list *app)
      |                                   ~~~~~~~~~^~~
jsapi.c: In function ‘JS_PushArgumentsVA’:
jsapi.c:376:39: error: passing argument 5 of ‘TryArgumentFormatter’ makes pointer from integer without a cast [-Wint-conversion]
  376 |                                       JS_ADDRESSOF_VA_LIST(ap))) {
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                       |
      |                                       int
jsapi.c:143:44: note: expected ‘__va_list_tag (*)[1]’ but argument is of type ‘int’
  143 |                      jsval **vpp, va_list *app)
      |                                   ~~~~~~~~~^~~
make[2]: *** [rules.mk:78: Linux_All_DBG.OBJ/jsapi.o] Error 1
make[2]: Leaving directory '/tmp/pacparser/src/spidermonkey/js/src'
make[1]: *** [Makefile:35: js-buildstamp] Error 2
make[1]: Leaving directory '/tmp/pacparser/src/spidermonkey'
make: *** [Makefile:96: jsapi_buildstamp] Error 2

Can be fixed by defining HAVE_VA_LIST_AS_ARRAY, although that shouldn't be a default, because it seems to break on some aarch64 systems.

@NGC2023
Copy link

NGC2023 commented Aug 1, 2024

Following patch worked for me both in amd64 and arm64.

--- a/src/spidermonkey/js/src/jsapi.c
+++ b/src/spidermonkey/js/src/jsapi.c
@@ -93,7 +93,7 @@
 #ifdef HAVE_VA_LIST_AS_ARRAY
 #define JS_ADDRESSOF_VA_LIST(ap) ((va_list *)(ap))
 #else
-#define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
+#define JS_ADDRESSOF_VA_LIST(ap) ((va_list *)(&(ap)))
 #endif
 
 #if defined(JS_PARANOID_REQUEST) && defined(JS_THREADSAFE)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants