[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lynx-dev] autotools vs. prototypes (was Re: ncurses configure test need

From: Thorsten Glaser
Subject: [Lynx-dev] autotools vs. prototypes (was Re: ncurses configure test needs to include term.h or termcap.h too)
Date: Thu, 27 Aug 2020 23:18:12 +0000 (UTC)

Ryan Schmidt dixit:

>Just to note, -Werror=implicit-function-declaration will be the default
>behavior of Apple clang soon, hence the report we received and the
>desire to fix this soon.

I implemented something similar in MirPorts (packaging framework for
MirBSD and other operating systems) and MirBSD core.

It turns out that you simply CANNOT do that.

Almost all GNU autoconf snippets make use of the fact that implicit
definitions, even with bogus prototypes, resolve at link time, to
detect functions.

I had to patch GCC to add a specific flag that adds -Wno-error if
a certain environment variable is present, so we can add all the
warning flags and -Werror to CFLAGS and have autofools propagate
these to the Makefiles but deactivate them during the configure
run itself.

It’s not just GNU autotools. Most build systems do this. I took
specific pains to avoid it in mirtoconf (mksh build system) but
that needs adapting to each and every operating system things are
ported to.

One example of such a stock configure test is:

| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char opendir ();
| int
| main ()
| {
| return opendir ();
|   ;
|   return 0;
| }

Just to demonstrate how bad the situation is. This affects
the vast majority of FOSS in the wild.

tl;dr: You cannot default to -Werror=implicit-function-declaration
*at all* or the usual ./configure; make; sudo make install trifecta
will break EVERYWHERE, and you MUST add functionality so that, if
it is present, it can be disabled from the environment.

Please *do* forward this to everyone who needs to hear this.

“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
        -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

reply via email to

[Prev in Thread] Current Thread [Next in Thread]