zsh-workers
 help / color / mirror / code / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Cc: Nicholas Vinson <nvinson234@gmail.com>
Subject: Re: [PATCH] Fix configure test build errors with clang-15
Date: Fri, 16 Sep 2022 18:33:45 +0900	[thread overview]
Message-ID: <42865334-AA03-4552-8CEB-89E41CD44E05@kba.biglobe.ne.jp> (raw)
In-Reply-To: <20220915023624.3384-1-nvinson234@gmail.com>

> 
> 2022/09/15 11:36, Nicholas Vinson <nvinson234@gmail.com> wrote:
> 
> When building with clang-15.0.0, I discovered several configure tests
> incorrectly fail because clang-15.0.0 errors with messages similar to:
> 
>    "error: type specifier missing, defaults to 'int'"
> 
> and similar such errors. These failed tests ultimately cause zsh to be
> built incorrectly, and can cause commands such as eval to hang
> indefinitely. For an example of this behavior please see
> https://bugs.gentoo.org/869539. This patch fixes the configure tests, so
> they do not incorrectly fail.

Thanks.

Could you please include the following changes to your patch and test again?
The changes are:
(1) remove (most of)
#include <stdlib.h>
which were added in commit bd647c156 to get the prototype of exit(),
(2) replace a few remaining exit() by return.

The patch below assumes that your patch is already applied.


diff --git a/aczsh.m4 b/aczsh.m4
index 2cfb4e5db..b31236020 100644
--- a/aczsh.m4
+++ b/aczsh.m4
@@ -119,7 +119,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
 AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
 AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
 #define RTLD_LAZY BIND_DEFERRED
@@ -202,7 +201,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
 AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
 AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
 #define RTLD_LAZY BIND_DEFERRED
@@ -278,7 +276,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
 AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
 AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
 #define RTLD_LAZY BIND_DEFERRED
@@ -349,7 +346,6 @@ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS
     save_ldflags=$LDFLAGS
     LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
 #define RTLD_LAZY BIND_DEFERRED
@@ -424,7 +420,6 @@ elif
     save_ldflags=$LDFLAGS
     LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS -s"
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
 #define RTLD_LAZY BIND_DEFERRED
@@ -493,7 +488,6 @@ echo 'int fred () { return 42; }' > conftest1.c
 if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
 AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
 #define RTLD_LAZY BIND_DEFERRED
diff --git a/configure.ac b/configure.ac
index 958ac7cd7..074141d38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1369,7 +1369,7 @@ zsh_cv_func_realpath_accepts_null,
 #include <stdlib.h>
 #include <limits.h>
 ],[
-exit(!realpath("/", (char*)0));
+return(!realpath("/", (char*)0));
 ])],
 [zsh_cv_func_realpath_accepts_null=yes],
 [zsh_cv_func_realpath_accepts_null=no],
@@ -1393,7 +1393,6 @@ AC_CACHE_CHECK(if tgetent accepts NULL,
 zsh_cv_func_tgetent_accepts_null,
 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <fcntl.h>
-#include <stdlib.h>
 int tgetent(char *, char *);
 char *tgetstr(char *, char **);
 int main()
@@ -1421,7 +1420,6 @@ AC_CACHE_CHECK(if tgetent returns 0 on success,
 zsh_cv_func_tgetent_zero_success,
 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <fcntl.h>
-#include <stdlib.h>
 int tgetent(char *, char*);
 char *tgetstr(char *, char **);
 int main()
@@ -1869,7 +1867,6 @@ zsh_cv_rlim_t_is_longer,
 #include <sys/time.h>
 #endif
 #include <sys/resource.h>
-#include <stdlib.h>
 int main(){struct rlimit r;return(sizeof(r.rlim_cur) <= sizeof(long));}]])],[zsh_cv_rlim_t_is_longer=yes],[zsh_cv_rlim_t_is_longer=no],[zsh_cv_rlim_t_is_longer=yes])])
 if test x$zsh_cv_rlim_t_is_longer = xyes; then
   AC_CACHE_CHECK(if rlim_t is a quad,
@@ -1880,7 +1877,6 @@ if test x$zsh_cv_rlim_t_is_longer = xyes; then
 #endif
 #include <stdio.h>
 #include <sys/resource.h>
-#include <stdlib.h>
 int main() {
   struct rlimit r;
   char buf[20];
@@ -1903,7 +1899,6 @@ else
 #include <sys/time.h>
 #endif
 #include <sys/resource.h>
-#include <stdlib.h>
   int main(){struct rlimit r;r.rlim_cur=-1;return(r.rlim_cur<0);}]])],[zsh_cv_type_rlim_t_is_unsigned=yes],[zsh_cv_type_rlim_t_is_unsigned=no],[zsh_cv_type_rlim_t_is_unsigned=no])])
   if test x$zsh_cv_type_rlim_t_is_unsigned = xyes; then
     AC_DEFINE(RLIM_T_IS_UNSIGNED)
@@ -2187,7 +2182,6 @@ zsh_cv_sys_fifo,
 #include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
-#include <stdlib.h>
 #include <sys/stat.h>
 int main()
 {
@@ -2200,7 +2194,7 @@ int main()
 #else
     if(mknod("/tmp/fifo$$", 0010600, 0) < 0)
 #endif
-	exit(1);
+	return(1);
     pid = fork();
     if(pid < 0)
 	return(1);
@@ -2289,7 +2283,6 @@ zsh_cv_sys_link,
 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <unistd.h>
 #include <fcntl.h>
-#include <stdlib.h>
 int main()
 {
     int ret;
@@ -2322,7 +2315,6 @@ zsh_cv_sys_killesrch,
 #include <unistd.h>
 #include <signal.h>
 #include <errno.h>
-#include <stdlib.h>
 int main()
 {
     int pid = (getpid() + 10000) & 0xffffff;
@@ -2348,7 +2340,6 @@ if test x$signals_style = xPOSIX_SIGNALS; then
     [AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <signal.h>
 #include <unistd.h>
-#include <stdlib.h>
 int child=0;
 void handler(sig)
     int sig;
@@ -2400,14 +2391,13 @@ case "x$zsh_working_tcsetpgrp" in
 #include <sys/types.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <stdlib.h>
 int main() {
     int fd;
     int ret;
     fd=open("/dev/tty", O_RDWR);
-    if (fd < 0) exit(2);
+    if (fd < 0) return(2);
     ret=tcsetpgrp(fd, tcgetpgrp(fd));
-    if (ret < 0) exit(1);
+    if (ret < 0) return(1);
     return(0);
 }
 ]])],[zsh_cv_sys_tcsetpgrp=yes],[
@@ -2775,14 +2765,13 @@ elif test "x$dynamic" = xyes; then
    zsh_cv_sys_elf,
    [AC_RUN_IFELSE([AC_LANG_SOURCE([[/* Test for whether ELF binaries are produced */
 #include <fcntl.h>
-#include <stdlib.h>
 #include <unistd.h>
 int main(int argc, char *argv[])
 {
 	char b[4];
 	int i = open(argv[0],O_RDONLY);
 	if(i == -1) 
-		exit(1); /* fail */
+		return(1); /* fail */
 	if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
 		return(0); /* succeed (yes, it's ELF) */
 	else
@@ -2928,7 +2917,6 @@ EOM
     AC_TRY_COMMAND($DLLD $LDFLAGS $DLLDFLAGS -o conftest.$DL_EXT conftest.o 1>&AS_MESSAGE_LOG_FD) &&
     AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <stdio.h>
-#include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
 #define RTLD_LAZY BIND_DEFERRED
@@ -2960,7 +2948,7 @@ int main()
     void * handle ;
     void * symbol ;
     FILE *f=fopen("conftestval", "w");
-    if (!f) exit(1);
+    if (!f) return(1);
     handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ;
     if (handle == NULL) {
         fprintf (f, "dlopen failed") ;






  parent reply	other threads:[~2022-09-16  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15  2:36 Nicholas Vinson
2022-09-15 22:29 ` Bart Schaefer
2022-09-16  5:49   ` Jun T
2022-09-16  6:40   ` Roman Perepelitsa
2022-09-16  9:33 ` Jun T [this message]
2022-09-16 11:58   ` Nicholas Vinson

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=42865334-AA03-4552-8CEB-89E41CD44E05@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=nvinson234@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).