Compilation fails when inttypes.h without uint_least32_t definition present but stdint.h with definition present
Larkin Nickle
me at larbob.org
Sun May 23 23:39:26 UTC 2021
Compilation of GMP fails when the system has an inttypes.h header
without uint_least32_t definition, even when there is a stdint.h with
the definition present.
Starting at line 154 in gmp-impl.h:
#if HAVE_INTTYPES_H /* for uint_least32_t */
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
#endif
Notice that if the system has inttypes.h, then stdint.h will not be
included. This is an issue on systems where the system has inttypes.h
without a uint_least32_t definition, but does have a fixed stdint.h
generated by GCC which does have a definition for it. Since stdint.h is
only included when inttypes.h isn't present, the fixed stdint.h isn't
pulled in. A system known to have this issue rear its head is Tru64.
Tested on Tru64 5.1B with GMP 6.1.0, compiling with GCC 4.7.4.
libtool: compile: alphaev56-dec-osf5.1b-gcc -std=gnu99 -DHAVE_CONFIG_H
-I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_mp_bases -mieee -O2
-pedantic -Wa,-arch,ev56 -mcpu=ev56 -c mp_bases.c -DPIC -o .libs/mp_bases.o
In file included from mp_bases.c:4:0:
../gmp-impl.h:232:1: error: unknown type name 'uint_least32_t'
make[2]: *** [mp_bases.lo] Error 1
If gmp-impl.h is edited to just pull in stdint.h, compilation continues.
Larkin
More information about the gmp-bugs
mailing list