with strict C99 the tests/mpz/convert.c needs #include <strings.h>

Dennis Clarke dclarke at blastwave.org
Sat Nov 7 23:45:52 UTC 2020


On a somewhat strange machine I was building with llvm/Clang on FreeBSD
and this :

ijiraq# uname -apKU
FreeBSD ijiraq 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r367349: Wed Nov  4
22:48:25 UTC 2020
root at FreeBSD-head-riscv64-build.jail.ci.FreeBSD.org:/usr/obj/usr/src/riscv.riscv64/sys/QEMU
 riscv riscv64 1300125 1300125
ijiraq#
ijiraq# cc --version
FreeBSD clang version 11.0.0 (git at github.com:llvm/llvm-project.git
llvmorg-11.0.0-0-g176249bd673)
Target: riscv64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
ijiraq#

CC=/usr/bin/cc

CFLAGS=-std=iso9899:1999 -m64 -g -O0 -pedantic -pedantic-errors
-march=rv64imafdc -mabi=lp64d -Weverything -Wno-reserved-id-macro
-Wno-unused-macros -Wno-missing-prototypes -Wno-padded -fno-fast-math
-fno-builtin

CPPFLAGS=-D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE
-D_XOPEN_SOURCE=600

CXXFLAGS=-m64 -g -O0 -march=rv64imafdc -mabi=lp64d -fno-fast-math
-fno-builtin

Wherein the config was :

./configure ABI=standard --enable-cxx --prefix=/opt/bw \
--libdir=/opt/bw/lib --disable-assembly


Seems to build fine.

However the tests blow up due to :

convert.c:143:11: error: implicit declaration of function 'strcasecmp'
is invalid in C99

So that is easy to fix.

ijiraq# diff -u ./tests/mpz/convert.c.orig ./tests/mpz/convert.c
--- ./tests/mpz/convert.c.orig  2020-01-17 13:44:49.000000000 +0000
+++ ./tests/mpz/convert.c       2020-11-07 22:51:36.823215000 +0000
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h> /* for strlen */
+#include <strings.h> /* for strcasecmp */

 #include "gmp-impl.h"
 #include "tests.h"
ijiraq#

Then tests continue swimmingly.


-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional


More information about the gmp-bugs mailing list