Skip to content

Build failure with GCC 15 (C23) #3206

@kostadinsh

Description

@kostadinsh

Describe the bug
jq fails to build with upcoming GCC 15 that defaults to C23. This can be reproduced on older GCC and Clang versions by adding -std=gnu23 to CFLAGS.

Downstream Gentoo bug: https://bugs.gentoo.org/944014

Environment (please complete the following information):

  • OS: Gentoo Linux
  • jq version: happens with both master and 1.7.1
src/builtin.c:1794:4: error: initialization of 'jv (*)(void)' from incompatible pointer type 'jv (*)(jq_state *, jv)' [-Wincompatible-pointer-types]
 1794 |   {f_ ## name, #name, 1},
      |    ^~
src/libm.h:2:1: note: in expansion of macro 'LIBM_DD'
    2 | LIBM_DD(acos)
      | ^~~~~~~
src/builtin.c:1794:4: note: (near initialization for 'function_list[0].fptr')
 1794 |   {f_ ## name, #name, 1},
      |    ^~
src/builtin.c:1800:4: error: initialization of 'jv (*)(void)' from incompatible pointer type 'jv (*)(jq_state *, jv,  jv,  jv)' [-Wincompatible-pointer-types]
 1800 |   {f_ ## name, #name, 3},
      |    ^~
src/libm.h:27:1: note: in expansion of macro 'LIBM_DDD'
   27 | LIBM_DDD(atan2)
      | ^~~~~~~~
src/builtin.c:1800:4: note: (near initialization for 'function_list[5].fptr')
 1800 |   {f_ ## name, #name, 3},
      |    ^~
src/libm.h:27:1: note: in expansion of macro 'LIBM_DDD'
   27 | LIBM_DDD(atan2)
      | ^~~~~~~~
src/builtin.c:1809:4: error: initialization of 'jv (*)(void)' from incompatible pointer type 'jv (*)(jq_state *, jv)' [-Wincompatible-pointer-types]
 1809 |   {f_negate, "_negate", 1},
      |    ^~~~~~~~
src/builtin.c:1809:4: note: (near initialization for 'function_list[61].fptr')
src/builtin.c:1810:22: error: initialization of 'jv (*)(void)' from incompatible pointer type 'jv (*)(jq_state *, jv,  jv,  jv)' [-Wincompatible-pointer-types]
 1810 | #define BINOP(name) {f_ ## name, "_" #name, 3},
      |                      ^~
src/builtin.h:11:3: note: in expansion of macro 'BINOP'
   11 |   BINOP(plus) \
      |   ^~~~~
src/builtin.c:1811:1: note: in expansion of macro 'BINOPS'
 1811 | BINOPS
      | ^~~~~~
src/builtin.c:1810:22: note: (near initialization for 'function_list[62].fptr')
 1810 | #define BINOP(name) {f_ ## name, "_" #name, 3},
      |                      ^~
src/builtin.h:11:3: note: in expansion of macro 'BINOP'
   11 |   BINOP(plus) \
      |   ^~~~~
src/builtin.c:1811:1: note: in expansion of macro 'BINOPS'
 1811 | BINOPS
      | ^~~~~~

Above are just some of the errors the rest are in the build log that's attached
build.log

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions