warning: type of ‘error’ does not match original declaration

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

warning: type of ‘error’ does not match original declaration

R. Diez
Hi all:

I am building GNU Make 4.3 with LTO, with the following commands:

mkdir /home/rdiez/rdiez/temp/make-4.3/make-4.3-obj

cd    /home/rdiez/rdiez/temp/make-4.3/make-4.3-obj
../make-4.3-src/configure CFLAGS="-g3 -O3 -march=native -flto" --prefix="/home/rdiez/rdiez/make-4.3-bin"
make --output-sync=recurse  -j "$(( $(getconf _NPROCESSORS_ONLN) + 1 ))"
make install-strip

I am getting the following warnings when compiling:

gcc  -g3 -O3 -march=native -flto -Wl,--export-dynamic  -o make src/ar.o src/arscan.o src/commands.o src/default.o src/dir.o src/expand.o src/file.o
src/function.o src/getopt.o src/getopt1.o src/guile.o src/hash.o src/implicit.o src/job.o src/load.o src/loadapi.o src/main.o src/misc.o src/output.o
src/read.o src/remake.o src/rule.o src/signame.o src/strcache.o src/variable.o src/version.o src/vpath.o  src/posixos.o  src/remote-stub.o
lib/libgnu.a   -ldl

../../make-4.3-src/lib/error.h:52:13: warning: type of ‘error’ does not match original declaration [-Wlto-type-mismatch]
../make-4.3-src/src/output.c:590:1: note: type mismatch in parameter 1
  error (const floc *flocp, size_t len, const char *fmt, ...)
  ^
../make-4.3-src/src/output.c:590:1: note: ‘error’ was previously declared here
../make-4.3-src/src/output.c:590:1: note: code may be misoptimized unless -fno-strict-aliasing is used

This is the declaration in error.h:

extern void error (int __status, int __errnum, const char *__format, ...)
      _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4));

And this is the one in output.c:

void
error (const floc *flocp, size_t len, const char *fmt, ...)

I think one of those "error" functions should be renamed, or declared static, or whatever.

Best regards,
   rdiez


Reply | Threaded
Open this post in threaded view
|

Re: warning: type of ‘error’ does not match original declaration

Paul Smith-20
On Mon, 2020-03-09 at 10:51 +0100, R. Diez wrote:
> ../../make-4.3-src/lib/error.h:52:13: warning: type of ‘error’ does not
> match original declaration [-Wlto-type-mismatch]
> ../make-4.3-src/src/output.c:590:1: note: type mismatch in parameter 1
>   error (const floc *flocp, size_t len, const char *fmt, ...)
>   ^

Ugh.  This is pulled in from gnulib.

Very annoying that it defines external linkage for common function names
like "error" when we didn't explicitly pull in that module from gnulib (it
was pulled in as a side-effect from some other module--in fact even that
other module was pulled in as a side-effect).

I don't know if there's any way to fix this except by renaming the make
version of error() so they don't conflict.