zsh-workers
 help / color / mirror / Atom feed
From: FX <fxcoudert@gmail.com>
To: zsh-workers@zsh.org
Subject: Many configure tests broken with clang 12
Date: Mon, 16 Nov 2020 12:34:43 +0100
Message-ID: <6C43F788-B057-4C5B-8FDD-932AC300549D@gmail.com> (raw)

Hello,

Building zsh 5.8 with clang 12 (which is the system compiler on recent macOS versions) leads to a completely broken zsh. This is because many configure tests actually fail, when they should succeed, because of undeclared functions. Take for example TGETENT_ACCEPTS_NULL in configure.ac:

[AC_RUN_IFELSE([AC_LANG_SOURCE([[
main()
{
    char buf[4096];
    int r1 = tgetent(buf, "vt100");
    int r2 = tgetent((char*)0,"vt100");
    if (r1 >= 0 && r1 == r2) {
        char tbuf[1024], *u;
        u = tbuf;
        tgetstr("cl", &u);
        creat("conftest.tgetent", 0640);
    }
    exit((r1 != r2) || r2 == -1);
}
]])]

This will fail for two reasons:

conftest.c:233:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:236:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]

tgetstr() should require the <term.h> header to be included in the test. And exit() needs <stdlib.h>

This occurs in a lot of places throughout the configure script. I have found the list below (see at end of message). clang 12 has made -Wimplicit-function-declaration into an error by default, which explains why these tests are now starting to fail. See our original report on Homebrew: https://github.com/Homebrew/homebrew-core/issues/64921

Best regards,
FX






fx@rmeur zsh-5.8 % grep 'implicitly declaring' config.log
conftest.c:236:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:236:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:255:24: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:255:40: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:293:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:291:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:287:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:302:9: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:286:5: error: implicitly declaring library function 'sprintf' with type 'int (char *, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
conftest.c:288:14: error: implicitly declaring library function 'strcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
conftest.c:291:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:291:31: error: implicitly declaring library function 'strcmp' with type 'int (const char *, const char *)' [-Werror,-Wimplicit-function-declaration]
conftest.c:320:13: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
fx@rmeur zsh-5.8 % grep 'C99' config.log        
conftest.c:228:14: error: implicit declaration of function 'tgetent' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:233:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:234:2: error: implicit declaration of function 'creat' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:228:14: error: implicit declaration of function 'tgetent' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:233:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:234:2: error: implicit declaration of function 'creat' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:287:5: error: implicit declaration of function 'unlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:289:8: error: implicit declaration of function 'mkfifo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:294:11: error: implicit declaration of function 'fork' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:299:17: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:302:22: error: implicit declaration of function 'write' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:286:27: error: implicit declaration of function 'getpid' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:286:37: error: implicit declaration of function 'rand' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:298:5: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]



             reply	other threads:[~2020-11-16 11:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 11:34 FX [this message]
2020-11-16 11:45 ` Jun. T
2020-11-16 11:53   ` FX
2020-11-16 12:14     ` Jun. T

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6C43F788-B057-4C5B-8FDD-932AC300549D@gmail.com \
    --to=fxcoudert@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git