Skip to content

Build fails with modern compilers

I tried to building with the following *FLAGS: -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types

These warnings are becoming default errors in GCC 14 and clang 16. They indicate code that was (usually) valid C89, but removed from the standard in C99 because they were so dangerous. Compilers are finally starting to enforce this, so code that uses it will not compile anymore after upgrading to the newest compilers, even if no -Werror is passed.

clisp failed to build:

gcc -I/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/src -I/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/builddir/gllib -I/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/src/gllib  -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -no-integrated-cpp -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -Wno-shift-negative-value -O -fwrapv -fno-strict-aliasing -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DNO_FAST_FLOAT -DNO_FAST_DOUBLE -DNO_ALLOCA -DNO_ADDRESS_SPACE_ASSUMPTIONS -DNO_GENERATIONAL_GC -DNO_SYMBOLFLAGS -DENABLE_UNICODE -DDYNAMIC_FFI -I. -I/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/builddir/linkkit \
	-c gdbm.m.c -o gdbm.o
In file included from /var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:9:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/builddir/linkkit/clisp.h: In function ‘check_byte_vector’:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/builddir/linkkit/clisp.h:6284:153: warning: result of ‘10^2’ is 8; did you mean ‘1e2’? [-Wxor-used-as-pow]
 6284 | static inline object check_byte_vector (object obj) { if (!((((oint)(obj) & 7) == (6+0)) && ((((sintB)((((Record)((oint)(obj)-6)))->tfl & 0xFF)) & ~(Rectype_Sbvector ^ Rectype_bvector)) == (Rectype_Sbvector & Rectype_bvector) + (3)) )) obj = check_byte_vector_replacement(obj); return obj; }
      |                                                                                                                                                         ^
      |                                                                                                                                                      --
      |                                                                                                                                                      1  e
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/builddir/linkkit/clisp.h:6284:150: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
 6284 | static inline object check_byte_vector (object obj) { if (!((((oint)(obj) & 7) == (6+0)) && ((((sintB)((((Record)((oint)(obj)-6)))->tfl & 0xFF)) & ~(Rectype_Sbvector ^ Rectype_bvector)) == (Rectype_Sbvector & Rectype_bvector) + (3)) )) obj = check_byte_vector_replacement(obj); return obj; }
      |                                                                                                                                                      ^~
      |                                                                                                                                                      0xa
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c: In function ‘open_gdbm’:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:127:2107: error: passing argument 5 of ‘gdbm_open’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  127 |   with_string_0(path, GLO(pathname_encoding), name, {
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^                         
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           void (*)(void)
In file included from /var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:16:
/usr/include/gdbm.h:127:29: note: expected ‘void (*)(const char *)’ but argument is of type ‘void (*)(void)’
  127 |                             void (*)(const char *));
      |                             ^~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c: In function ‘coerce_bitvector’:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:208:100: warning: result of ‘10^2’ is 8; did you mean ‘1e2’? [-Wxor-used-as-pow]
  208 |   if (bit_vector_p(Atype_8Bit,arg)) return arg;
      |                                                                                                    ^
      |                                                                                                 --
      |                                                                                                 1  e
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:208:97: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
  208 |   if (bit_vector_p(Atype_8Bit,arg)) return arg;
      |                                                                                                 ^ 
      |                                                                                                 0xa
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:212:119: warning: result of ‘10^2’ is 8; did you mean ‘1e2’? [-Wxor-used-as-pow]
  212 |     if (!bit_vector_p(Atype_8Bit,value1)) { NOTREACHED; }
      |                                                                                                                       ^
      |                                                                                                                    --
      |                                                                                                                    1  e
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:212:116: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
  212 |     if (!bit_vector_p(Atype_8Bit,value1)) { NOTREACHED; }
      |                                                                                                                    ^ 
      |                                                                                                                    0xa
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c: In function ‘C_subr_gdbm_gdbm_fetch’:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:352:2651: warning: result of ‘10^2’ is 8; did you mean ‘1e2’? [-Wxor-used-as-pow]
  352 |   with_datum(STACK_0, key, res = gdbm_fetch(dbf,key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        --
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1  e
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:352:2648: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
  352 |   with_datum(STACK_0, key, res = gdbm_fetch(dbf,key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ^ 
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        0xa
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c: In function ‘C_subr_gdbm_gdbm_delete’:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:363:2655: warning: result of ‘10^2’ is 8; did you mean ‘1e2’? [-Wxor-used-as-pow]
  363 |   with_datum(STACK_0, key, status = gdbm_delete(dbf,key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ^
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            --
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1  e
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:363:2652: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
  363 |   with_datum(STACK_0, key, status = gdbm_delete(dbf,key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ^ 
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            0xa
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c: In function ‘C_subr_gdbm_gdbm_nextkey’:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:386:2653: warning: result of ‘10^2’ is 8; did you mean ‘1e2’? [-Wxor-used-as-pow]
  386 |   with_datum(STACK_1, key, res = gdbm_nextkey(dbf,key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          --
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1  e
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:386:2650: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
  386 |   with_datum(STACK_1, key, res = gdbm_nextkey(dbf,key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ^ 
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0xa
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c: In function ‘C_subr_gdbm_gdbm_exists’:
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:421:2656: warning: result of ‘10^2’ is 8; did you mean ‘1e2’? [-Wxor-used-as-pow]
  421 |   with_datum(STACK_0, key, status = gdbm_exists(dbf, key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ^
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             --
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1  e
/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/modules/gdbm/gdbm.c:421:2653: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
  421 |   with_datum(STACK_0, key, status = gdbm_exists(dbf, key));
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^ 
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             0xa
cc1: some warnings being treated as errors
make[1]: *** [Makefile:28: gdbm.o] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-lisp/clisp-2.49.92-r1/work/clisp-2.49.92/builddir/gdbm'
make: *** [Makefile:2357: gdbm] Error 2
 * ERROR: dev-lisp/clisp-2.49.92-r1::gentoo failed (compile phase):

Originally reported downstream at https://bugs.gentoo.org/919233 Full build log: build.log