[PATCH] Fix compile error in configure script
Edgar Bonet
bonet at grenoble.cnrs.fr
Fri May 17 19:27:07 UTC 2024
Hello!
Sergey Kandaurov wrote:
> > objs/autotest.c:9:48: error: passing argument 1
> > of 'AO_compare_and_swap' from incompatible pointer type
> > [-Wincompatible-pointer-types]
>
> Where did you try to build?
I experienced this when building for arm and i686, both cross-compiled
from x86_64. Building for x86_64 works fine.
> Usually, long and size_t (a "common default" for AO_t) have the same
> underlying type, unless you build with something like MSVC.
AO_t is a 'volatile size_t'. The volatile qualifier may not matter
though. The error message about incompatible types was followed by
this note:
expected 'volatile size_t *' {aka 'volatile unsigned int *'}
but argument is of type 'long int *'
My understanding is that the compiler considers 'int' and 'long' to be
incompatible types, even though they have the same underlying
representation on ILP32 environments. I'm not a language lawyer, so I
cannot tell _why_ they are considered incompatible. But then, 'size_t'
being an 'unsigned int', it is incompatible with 'long'.
On LP64 (your typical 64-bit Linux/Mac), 'size_t' is a 'unsigned long',
which is compatible with 'long' but for the signedness warning.
Regards,
Edgar.
More information about the nginx-devel
mailing list