Possibly an annoying test in configure

Niels Möller nisse at lysator.liu.se
Sun Aug 20 09:33:09 CEST 2023

Dennis Clarke <dclarke at blastwave.org> writes:

> With GMP ver 6.3.0 I run into the same sort of thing :
> conftest.c:2:10: error: a function declaration without a prototype is
> deprecated in all versions of C [-Werror,-Wstrict-prototypes]
> int main () { return 0; }
>          ^
>           void

The configure script is really not written to support running with
-Werror, and I suspect that fixing that properaly would be a rather
large undertaking. In particular to support it in combination with
arbitrary other warning options that might be enabled by users, like
-Wall, -Wextra or -pedantic.

Even supporting building the library itself with -Werror is rather
questionable, imo.

My view on -Werror is that it is useful for a maintainer that aims to
address certain warnings on certain compilers/platforms, and is prepared
to fix all resulting errors by code changes or tweaks of -Wno-foo

I would *not* want to support -Werror as something to be used in general
by users, with arbitrary compiler versions, compile flag tweaks, etc.
It would be good to properly document support or lack thereof.

(Which doesn't mean that I'm against bug reports about fixing particular
warnings; making small code changes to avoid warings is often a good
thing, imo).

> int main () { return 0; }
> configure:7072: result: no
> configure:7310: error: could not find a working compiler, see
> config.log for details
> This is seen on FreeBSD 14.0 on a RISC-V machine ( the SiFive board )
> however I bet it happens just about anywhere if one goes with strict

My expectation is that if not using the -Werror option (or equivalent
for other compilers), the test is very widely portable in practice.

Since gmp doesn't support K&R C any longer, it would make some sense to
update GMP-specific tests to use proper prototypes, but as far as I'm
aware, many of the "standard" autoconf macros still intentionally skip
prototype declarations, e.g., to test for existence of a function that
may have slightly different prototype on different systems. So even
fixing all GMP-specific tests would likely not solve your problem (but
feel free to try that out, if you believe that would be useful).


Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list