zsh-workers
 help / color / mirror / Atom feed
* [PATCH 0/3] Build fixes
@ 2020-12-31  5:41 Felipe Contreras
  2020-12-31  5:41 ` [PATCH 1/3] src: fix build warnings Felipe Contreras
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Felipe Contreras @ 2020-12-31  5:41 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

There's a couple of warnings I get all the time that I've fixed.

And recently Arch Linux updated autoconf to 2.70, which throws a bunch of errors.

Everything seems to be fixed now, and it works fine on autoconf 2.69 as well.

Felipe Contreras (3):
  src: fix build warnings
  autoconf: remove deprecated functions
  autoconf: prepare for 2.70

 Src/Modules/files.c |   6 ---
 Src/mem.c           |  16 ++-----
 Src/pattern.c       |   2 +-
 Src/utils.c         |   3 +-
 Src/zsh_system.h    |  21 +--------
 aclocal.m4          |   8 ++--
 aczsh.m4            | 104 ++++++++++++++++++++++----------------------
 configure.ac        |   4 +-
 8 files changed, 66 insertions(+), 98 deletions(-)

-- 
2.30.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/3] src: fix build warnings
  2020-12-31  5:41 [PATCH 0/3] Build fixes Felipe Contreras
@ 2020-12-31  5:41 ` Felipe Contreras
  2021-01-02 11:22   ` Daniel Shahaf
  2020-12-31  5:41 ` [PATCH 2/3] autoconf: remove deprecated functions Felipe Contreras
  2020-12-31  5:41 ` [PATCH 3/3] autoconf: prepare for 2.70 Felipe Contreras
  2 siblings, 1 reply; 21+ messages in thread
From: Felipe Contreras @ 2020-12-31  5:41 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

  pattern.c: In function ‘patcomppiece’:
  pattern.c:1253:14: warning: ‘from’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   1253 |     zrange_t from, to;
        |              ^~~~
  utils.c: In function ‘getkeystring’:
  cc1: warning: function may return address of local variable [-Wreturn-local-addr]
  utils.c:6703:16: note: declared here
   6703 |     char *buf, tmp[1];
        |                ^~~

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Src/pattern.c | 2 +-
 Src/utils.c   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Src/pattern.c b/Src/pattern.c
index c7c2c8bea..c28f2c9fb 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -1250,7 +1250,7 @@ patcomppiece(int *flagp, int paren)
     int hash, count;
     union upat up;
     char *nptr, *str0, *ptr, *patprev;
-    zrange_t from, to;
+    zrange_t from = 0, to;
     char *charstart;
 
     flags = 0;
diff --git a/Src/utils.c b/Src/utils.c
index 5151b89a8..37ae4c854 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -6700,7 +6700,8 @@ ucs4toutf8(char *dest, unsigned int wval)
 mod_export char *
 getkeystring(char *s, int *len, int how, int *misc)
 {
-    char *buf, tmp[1];
+    static char tmp[1];
+    char *buf;
     char *t, *tdest = NULL, *u = NULL, *sstart = s, *tbuf = NULL;
     char svchar = '\0';
     int meta = 0, control = 0, ignoring = 0;
-- 
2.30.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/3] autoconf: remove deprecated functions
  2020-12-31  5:41 [PATCH 0/3] Build fixes Felipe Contreras
  2020-12-31  5:41 ` [PATCH 1/3] src: fix build warnings Felipe Contreras
@ 2020-12-31  5:41 ` Felipe Contreras
  2021-03-27 19:37   ` Lawrence Velázquez
  2020-12-31  5:41 ` [PATCH 3/3] autoconf: prepare for 2.70 Felipe Contreras
  2 siblings, 1 reply; 21+ messages in thread
From: Felipe Contreras @ 2020-12-31  5:41 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

STDC_HEADERS and TIME_WITH_SYS_TIME are deprecated.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Src/Modules/files.c |  6 ------
 Src/mem.c           | 16 ++++------------
 Src/zsh_system.h    | 21 ++-------------------
 configure.ac        |  4 +---
 4 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index 7ebacba6c..a1d6f6bf2 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -32,12 +32,6 @@
 typedef int (*MoveFunc) _((char const *, char const *));
 typedef int (*RecurseFunc) _((char *, char *, struct stat const *, void *));
 
-#ifndef STDC_HEADERS
-extern int link _((const char *, const char *));
-extern int symlink _((const char *, const char *));
-extern int rename _((const char *, const char *));
-#endif
-
 struct recursivecmd;
 
 #include "files.pro"
diff --git a/Src/mem.c b/Src/mem.c
index 5951e57ed..25b2bbce7 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1072,18 +1072,10 @@ zrealloc(void *ptr, size_t size)
 # endif
 #endif
 
-#if defined(_BSD) && !defined(STDC_HEADERS)
-# define FREE_RET_T   int
-# define FREE_ARG_T   char *
-# define FREE_DO_RET
-# define MALLOC_RET_T char *
-# define MALLOC_ARG_T size_t
-#else
-# define FREE_RET_T   void
-# define FREE_ARG_T   void *
-# define MALLOC_RET_T void *
-# define MALLOC_ARG_T size_t
-#endif
+#define FREE_RET_T   void
+#define FREE_ARG_T   void *
+#define MALLOC_RET_T void *
+#define MALLOC_ARG_T size_t
 
 /* structure for building free list in blocks holding small blocks */
 
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index 161b073b4..6f4efce96 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -235,16 +235,8 @@ char *alloca _((size_t));
 # include <errno.h>
 #endif
 
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
+#include <sys/time.h>
+#include <time.h>
 
 /* This is needed by some old SCO unices */
 #if !defined(HAVE_STRUCT_TIMEZONE) && !defined(ZSH_OOT_MODULE)
@@ -279,16 +271,7 @@ struct timespec {
 # include <sys/times.h>
 #endif
 
-#if STDC_HEADERS || HAVE_STRING_H
 # include <string.h>
-/* An ANSI string.h and pre-ANSI memory.h might conflict.  */
-# if !STDC_HEADERS && HAVE_MEMORY_H
-#  include <memory.h>
-# endif /* not STDC_HEADERS and HAVE_MEMORY_H */
-#else   /* not STDC_HEADERS and not HAVE_STRING_H */
-# include <strings.h>
-/* memory.h and strings.h conflict on some systems.  */
-#endif /* not STDC_HEADERS and not HAVE_STRING_H */
 
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
diff --git a/configure.ac b/configure.ac
index 549cae3d6..c39915528 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ dnl
 AC_INIT
 AC_CONFIG_SRCDIR([Src/zsh.h])
 AC_PREREQ([2.69])
-AC_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
 
 dnl What version of zsh are we building ?
 . ${srcdir}/Config/version.mk
@@ -657,8 +657,6 @@ dnl ------------------
 dnl CHECK HEADER FILES
 dnl ------------------
 AC_HEADER_DIRENT
-AC_HEADER_STDC
-AC_HEADER_TIME
 AC_HEADER_STAT
 AC_HEADER_SYS_WAIT
 
-- 
2.30.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 3/3] autoconf: prepare for 2.70
  2020-12-31  5:41 [PATCH 0/3] Build fixes Felipe Contreras
  2020-12-31  5:41 ` [PATCH 1/3] src: fix build warnings Felipe Contreras
  2020-12-31  5:41 ` [PATCH 2/3] autoconf: remove deprecated functions Felipe Contreras
@ 2020-12-31  5:41 ` Felipe Contreras
  2021-03-27 19:38   ` Lawrence Velázquez
  2 siblings, 1 reply; 21+ messages in thread
From: Felipe Contreras @ 2020-12-31  5:41 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 aclocal.m4 |   8 ++---
 aczsh.m4   | 104 ++++++++++++++++++++++++++---------------------------
 2 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index e91be3c0d..c26e2d834 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -35,14 +35,14 @@ ac_save_CFLAGS="$CFLAGS"
 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" -Xc
 do
   CFLAGS="$ac_save_CFLAGS $ac_arg"
-  AC_TRY_COMPILE(
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 [#ifndef __STDC__
 choke me
 #endif	
-], [int test (int i, double x);
+]], [[int test (int i, double x);
 struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};],
-[fp_cv_prog_cc_stdc="$ac_arg"; break])
+struct s2 {int (*f) (double a);};]])],
+[fp_cv_prog_cc_stdc="$ac_arg"; break],[])
 done
 CFLAGS="$ac_save_CFLAGS"
 ])
diff --git a/aczsh.m4 b/aczsh.m4
index 40d3b04f2..c04bf9190 100644
--- a/aczsh.m4
+++ b/aczsh.m4
@@ -39,7 +39,7 @@ dnl   before finding the right type.
 dnl
 
 AC_DEFUN(zsh_64_BIT_TYPE,
-[AC_TRY_RUN([
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -50,7 +50,7 @@ main()
   int bar = (int) foo;
   return sizeof($1) != 8;
 }
-], $2="$1", $2=no,
+]])],[$2="$1"],[$2=no],
   [if test x$3 != x ; then
     $2="$1"
   else
@@ -113,11 +113,11 @@ void *zsh_getaddr1()
 };
 ' > conftest1.c
 sed 's/zsh_getaddr1/zsh_getaddr2/' < conftest1.c > conftest2.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then
-    AC_TRY_RUN([
+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 conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD) &&
+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>
@@ -170,7 +170,7 @@ main()
     if(sym1 != sym2) exit(1);
     exit(0);
 }
-], [zsh_cv_shared_$1=yes],
+]])],[zsh_cv_shared_$1=yes],
 [zsh_cv_shared_$1=no],
 [zsh_cv_shared_$1=no]
 )
@@ -195,11 +195,11 @@ else
 fi
 echo 'int fred () { return 42; }' > conftest1.c
 echo 'int fred () { return 69; }' > conftest2.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then
-    AC_TRY_RUN([
+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 conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD) &&
+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>
@@ -242,7 +242,7 @@ main()
     if(!fred1 || !fred2) exit(1);
     exit((*fred1)() != 42 || (*fred2)() != 69);
 }
-], [zsh_cv_sys_dynamic_clash_ok=yes],
+]])],[zsh_cv_sys_dynamic_clash_ok=yes],
 [zsh_cv_sys_dynamic_clash_ok=no],
 [zsh_cv_sys_dynamic_clash_ok=no]
 )
@@ -271,11 +271,11 @@ else
 fi
 echo 'int fred () { return 42; }' > conftest1.c
 echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest2.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then
-    AC_TRY_RUN([
+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 conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD) &&
+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>
@@ -316,7 +316,7 @@ main()
     if(!barneysym) exit(1);
     exit((*barneysym)() != 69);
 }
-], [zsh_cv_sys_dynamic_rtld_global=yes],
+]])],[zsh_cv_sys_dynamic_rtld_global=yes],
 [zsh_cv_sys_dynamic_rtld_global=no],
 [zsh_cv_sys_dynamic_rtld_global=no]
 )
@@ -341,11 +341,11 @@ else
     us=
 fi
 echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest1.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC); then
+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 conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
     save_ldflags=$LDFLAGS
     LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
-    AC_TRY_RUN([
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
@@ -386,7 +386,7 @@ main()
 }
 
 int fred () { return 42; }
-], [zsh_cv_sys_dynamic_execsyms=yes],
+]])],[zsh_cv_sys_dynamic_execsyms=yes],
 [zsh_cv_sys_dynamic_execsyms=no],
 [zsh_cv_sys_dynamic_execsyms=no]
 )
@@ -415,11 +415,11 @@ elif
 	us=
     fi
     echo 'extern int fred(); int barney() { return fred() + 27; }' > conftest1.c
-    AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-    AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC); then
+    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 conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
     save_ldflags=$LDFLAGS
     LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS -s"
-    AC_TRY_RUN([
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <stdlib.h>
 #ifdef HPUX10DYNAMIC
 #include <dl.h>
@@ -460,7 +460,7 @@ main()
 }
 
 int fred () { return 42; }
-], [zsh_cv_sys_dynamic_strip_exe=yes],
+]])],[zsh_cv_sys_dynamic_strip_exe=yes],
 [zsh_cv_sys_dynamic_strip_exe=no],
 [zsh_cv_sys_dynamic_strip_exe=no]
 )
@@ -485,9 +485,9 @@ else
     us=
 fi
 echo 'int fred () { return 42; }' > conftest1.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&AC_FD_CC); then
-    AC_TRY_RUN([
+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>
@@ -526,7 +526,7 @@ main()
     if(!fredsym) exit(1);
     exit((*fredsym)() != 42);
 }
-], [zsh_cv_sys_dynamic_strip_lib=yes],
+]])],[zsh_cv_sys_dynamic_strip_lib=yes],
 [zsh_cv_sys_dynamic_strip_lib=no],
 [zsh_cv_sys_dynamic_strip_lib=no]
 )
@@ -564,7 +564,7 @@ dnl
 
 AC_DEFUN(zsh_TYPE_EXISTS,
 [AC_CACHE_CHECK([for $2], [zsh_cv_type_exists_[]translit($2, [ ], [_])],
-[AC_TRY_COMPILE([$1], [$2 testvar;],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2 testvar;]])],
 [zsh_cv_type_exists_[]translit($2, [ ], [_])=yes],
 [zsh_cv_type_exists_[]translit($2, [ ], [_])=no])
 ])
@@ -583,7 +583,7 @@ dnl
 
 AC_DEFUN(zsh_STRUCT_MEMBER,
 [AC_CACHE_CHECK([for $3 in $2], [zsh_cv_struct_member_[]translit($2, [ ], [_])_$3],
-[AC_TRY_COMPILE([$1], [$2 testvar; testvar.$3;],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2 testvar; testvar.$3;]])],
 [zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=yes],
 [zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=no])
 ])
@@ -621,25 +621,25 @@ AC_SUBST(tzsh)dnl
 
 AC_DEFUN(zsh_COMPILE_FLAGS,
     [AC_ARG_ENABLE(cppflags,
-	AC_HELP_STRING([--enable-cppflags=...], [specify C preprocessor flags]),
+	AS_HELP_STRING([--enable-cppflags=...], [specify C preprocessor flags]),
 	if test "$enableval" = "yes"
 	then CPPFLAGS="$1"
 	else CPPFLAGS="$enable_cppflags"
 	fi)
     AC_ARG_ENABLE(cflags,
-	AC_HELP_STRING([--enable-cflags=...], [specify C compiler flags]),
+	AS_HELP_STRING([--enable-cflags=...], [specify C compiler flags]),
 	if test "$enableval" = "yes"
 	then CFLAGS="$2"
 	else CFLAGS="$enable_cflags"
 	fi)
     AC_ARG_ENABLE(ldflags,
-	AC_HELP_STRING([--enable-ldflags=...], [specify linker flags]),
+	AS_HELP_STRING([--enable-ldflags=...], [specify linker flags]),
 	if test "$enableval" = "yes"
 	then LDFLAGS="$3"
 	else LDFLAGS="$enable_ldflags"
 	fi)
     AC_ARG_ENABLE(libs,
-	AC_HELP_STRING([--enable-libs=...], [specify link libraries]),
+	AS_HELP_STRING([--enable-libs=...], [specify link libraries]),
 	if test "$enableval" = "yes"
 	then LIBS="$4"
 	else LIBS="$enable_libs"
@@ -658,10 +658,10 @@ AC_DEFUN([zsh_CHECK_SOCKLEN_T],[
     [zsh_cv_type_socklen_t],
     [zsh_cv_type_socklen_t=
     for zsh_type in socklen_t int "unsigned long" size_t ; do
-      AC_TRY_COMPILE(
-        [#include <sys/types.h>
-         #include <sys/socket.h>],
-        [extern int accept (int, struct sockaddr *, $zsh_type *);],
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+        [[#include <sys/types.h>
+          #include <sys/socket.h>]],
+        [[extern int accept (int, struct sockaddr *, $zsh_type *);]])],
         [zsh_cv_type_socklen_t="$zsh_type"; break],
         []
       )
@@ -680,15 +680,15 @@ AC_DEFUN(zsh_LIMIT_PRESENT,
 [Define to 1 if ]$1[ is present (whether or not as a macro).])
 AC_CACHE_CHECK([for limit $1],
 zsh_cv_have_$1,
-[AC_TRY_COMPILE([
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
-#include <sys/resource.h>],
-[$1],
-  zsh_cv_have_$1=yes,
-  zsh_cv_have_$1=no)])
+#include <sys/resource.h>]],
+[[$1]])],
+  [zsh_cv_have_$1=yes],
+  [zsh_cv_have_$1=no])])
 
 if test $zsh_cv_have_$1 = yes; then
   AC_DEFINE(HAVE_$1)
@@ -701,15 +701,15 @@ AC_DEFUN(zsh_LIMITS_EQUAL,
 [Define to 1 if RLIMIT_]$1[ and RLIMIT_]$3[ both exist and are equal.])
 AC_CACHE_CHECK([if RLIMIT_]$1[ and RLIMIT_]$3[ are the same],
 zsh_cv_rlimit_$2_is_$4,
-[AC_TRY_COMPILE([
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
-#include <sys/resource.h>],
-[static char x[(RLIMIT_$1 == RLIMIT_$3)? 1 : -1]],
-  zsh_cv_rlimit_$2_is_$4=yes,
-  zsh_cv_rlimit_$2_is_$4=no)])
+#include <sys/resource.h>]],
+[[static char x[(RLIMIT_$1 == RLIMIT_$3)? 1 : -1]]])],
+  [zsh_cv_rlimit_$2_is_$4=yes],
+  [zsh_cv_rlimit_$2_is_$4=no])])
 if test x$zsh_cv_rlimit_$2_is_$4 = xyes; then
   AC_DEFINE(RLIMIT_$1_IS_$3)
 fi])
-- 
2.30.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/3] src: fix build warnings
  2020-12-31  5:41 ` [PATCH 1/3] src: fix build warnings Felipe Contreras
@ 2021-01-02 11:22   ` Daniel Shahaf
  2021-01-02 16:41     ` Mikael Magnusson
  0 siblings, 1 reply; 21+ messages in thread
From: Daniel Shahaf @ 2021-01-02 11:22 UTC (permalink / raw)
  To: Felipe Contreras, zsh-workers

Felipe Contreras wrote on Thu, 31 Dec 2020 05:41 +00:00:
>   utils.c: In function ‘getkeystring’:
>   cc1: warning: function may return address of local variable [-Wreturn-local-addr]
>   utils.c:6703:16: note: declared here
>    6703 |     char *buf, tmp[1];
>         |                ^~~
> 
> diff --git a/Src/utils.c b/Src/utils.c
> index 5151b89a8..37ae4c854 100644
> --- a/Src/utils.c
> +++ b/Src/utils.c
> @@ -6700,7 +6700,8 @@ ucs4toutf8(char *dest, unsigned int wval)
>  mod_export char *
>  getkeystring(char *s, int *len, int how, int *misc)
>  {
> -    char *buf, tmp[1];
> +    static char tmp[1];
> +    char *buf;

The docstring explicitly promises the returned string will be newly-
allocated from the heap, so this change makes the implementation
inconsistent with the docstring.

No comment on the pattern.c part.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/3] src: fix build warnings
  2021-01-02 11:22   ` Daniel Shahaf
@ 2021-01-02 16:41     ` Mikael Magnusson
  2021-01-02 18:30       ` Felipe Contreras
  0 siblings, 1 reply; 21+ messages in thread
From: Mikael Magnusson @ 2021-01-02 16:41 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Felipe Contreras, zsh-workers

On 1/2/21, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Felipe Contreras wrote on Thu, 31 Dec 2020 05:41 +00:00:
>>   utils.c: In function ‘getkeystring’:
>>   cc1: warning: function may return address of local variable
>> [-Wreturn-local-addr]
>>   utils.c:6703:16: note: declared here
>>    6703 |     char *buf, tmp[1];
>>         |                ^~~
>>
>> diff --git a/Src/utils.c b/Src/utils.c
>> index 5151b89a8..37ae4c854 100644
>> --- a/Src/utils.c
>> +++ b/Src/utils.c
>> @@ -6700,7 +6700,8 @@ ucs4toutf8(char *dest, unsigned int wval)
>>  mod_export char *
>>  getkeystring(char *s, int *len, int how, int *misc)
>>  {
>> -    char *buf, tmp[1];
>> +    static char tmp[1];
>> +    char *buf;
>
> The docstring explicitly promises the returned string will be newly-
> allocated from the heap, so this change makes the implementation
> inconsistent with the docstring.

If we ever return the address of tmp, bad things are likely to happen
regardless of the static so hopefully that never happens. Returning
the address of a local variable basically means it will be junk
(current hypothetical behavior), whereas returning a static means the
function wouldn't be re-entrant (hypothetical behavior with the
patch). I don't think any reading of "newly allocated from the heap"
would include a location on a popped stack though, so I don't see how
the docstring enters into it at all.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/3] src: fix build warnings
  2021-01-02 16:41     ` Mikael Magnusson
@ 2021-01-02 18:30       ` Felipe Contreras
  2021-01-04  5:14         ` Daniel Shahaf
  0 siblings, 1 reply; 21+ messages in thread
From: Felipe Contreras @ 2021-01-02 18:30 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Daniel Shahaf, Zsh hackers list

On Sat, Jan 2, 2021 at 10:41 AM Mikael Magnusson <mikachu@gmail.com> wrote:

> If we ever return the address of tmp, bad things are likely to happen
> regardless of the static so hopefully that never happens. Returning
> the address of a local variable basically means it will be junk
> (current hypothetical behavior), whereas returning a static means the
> function wouldn't be re-entrant (hypothetical behavior with the
> patch).

Correct, but one is more proper than the other, and it gets rid of the warning.

The best fix is to allocate one byte, especially if it's going to be
freed later on.

-- 
Felipe Contreras


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/3] src: fix build warnings
  2021-01-02 18:30       ` Felipe Contreras
@ 2021-01-04  5:14         ` Daniel Shahaf
  2021-03-27 19:28           ` Lawrence Velázquez
  0 siblings, 1 reply; 21+ messages in thread
From: Daniel Shahaf @ 2021-01-04  5:14 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Mikael Magnusson, Zsh hackers list

Felipe Contreras wrote on Sat, 02 Jan 2021 12:30 -0600:
> The best fix is to allocate one byte, especially if it's going to be
> freed later on.

Yes, please revise the patch to allocate byte(s) from the heap as
needed.  (See comments at the top of mem.c, and, for instance,
dupstring() v. ztrdup().)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/3] src: fix build warnings
  2021-01-04  5:14         ` Daniel Shahaf
@ 2021-03-27 19:28           ` Lawrence Velázquez
  2021-04-04  6:38             ` Jun. T
  0 siblings, 1 reply; 21+ messages in thread
From: Lawrence Velázquez @ 2021-03-27 19:28 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: zsh-workers

Hi,

On Mon, Jan 4, 2021, at 12:14 AM, Daniel Shahaf wrote:
> Felipe Contreras wrote on Sat, 02 Jan 2021 12:30 -0600:
> > The best fix is to allocate one byte, especially if it's going to be
> > freed later on.
> 
> Yes, please revise the patch to allocate byte(s) from the heap as
> needed.  (See comments at the top of mem.c, and, for instance,
> dupstring() v. ztrdup().)

Any plans to send a revised patch?

vq


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/3] autoconf: remove deprecated functions
  2020-12-31  5:41 ` [PATCH 2/3] autoconf: remove deprecated functions Felipe Contreras
@ 2021-03-27 19:37   ` Lawrence Velázquez
  2021-04-03 15:04     ` Lawrence Velázquez
  0 siblings, 1 reply; 21+ messages in thread
From: Lawrence Velázquez @ 2021-03-27 19:37 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

On Thu, Dec 31, 2020, at 12:41 AM, Felipe Contreras wrote:
> STDC_HEADERS and TIME_WITH_SYS_TIME are deprecated.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  Src/Modules/files.c |  6 ------
>  Src/mem.c           | 16 ++++------------
>  Src/zsh_system.h    | 21 ++-------------------
>  configure.ac        |  4 +---
>  4 files changed, 7 insertions(+), 40 deletions(-)

ping for review

vq


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2020-12-31  5:41 ` [PATCH 3/3] autoconf: prepare for 2.70 Felipe Contreras
@ 2021-03-27 19:38   ` Lawrence Velázquez
  2021-04-03 15:44     ` Lawrence Velázquez
  0 siblings, 1 reply; 21+ messages in thread
From: Lawrence Velázquez @ 2021-03-27 19:38 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

On Thu, Dec 31, 2020, at 12:41 AM, Felipe Contreras wrote:
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  aclocal.m4 |   8 ++---
>  aczsh.m4   | 104 ++++++++++++++++++++++++++---------------------------
>  2 files changed, 56 insertions(+), 56 deletions(-)

ping for review

vq


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/3] autoconf: remove deprecated functions
  2021-03-27 19:37   ` Lawrence Velázquez
@ 2021-04-03 15:04     ` Lawrence Velázquez
  0 siblings, 0 replies; 21+ messages in thread
From: Lawrence Velázquez @ 2021-04-03 15:04 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

On Sat, Mar 27, 2021, at 3:37 PM, Lawrence Velázquez wrote:
> On Thu, Dec 31, 2020, at 12:41 AM, Felipe Contreras wrote:
> > STDC_HEADERS and TIME_WITH_SYS_TIME are deprecated.
> > 
> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> > ---
> >  Src/Modules/files.c |  6 ------
> >  Src/mem.c           | 16 ++++------------
> >  Src/zsh_system.h    | 21 ++-------------------
> >  configure.ac        |  4 +---
> >  4 files changed, 7 insertions(+), 40 deletions(-)
> 
> ping for review

The Ping for Review Part II

vq


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-03-27 19:38   ` Lawrence Velázquez
@ 2021-04-03 15:44     ` Lawrence Velázquez
  2021-04-08 22:44       ` Oliver Kiddle
  0 siblings, 1 reply; 21+ messages in thread
From: Lawrence Velázquez @ 2021-04-03 15:44 UTC (permalink / raw)
  To: zsh-workers

On Sat, Mar 27, 2021, at 3:38 PM, Lawrence Velázquez wrote:
> On Thu, Dec 31, 2020, at 12:41 AM, Felipe Contreras wrote:
> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> > ---
> >  aclocal.m4 |   8 ++---
> >  aczsh.m4   | 104 ++++++++++++++++++++++++++---------------------------
> >  2 files changed, 56 insertions(+), 56 deletions(-)
> 
> ping for review

ppiinngg ffoorr rreevviieeww

vq


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/3] src: fix build warnings
  2021-03-27 19:28           ` Lawrence Velázquez
@ 2021-04-04  6:38             ` Jun. T
  0 siblings, 0 replies; 21+ messages in thread
From: Jun. T @ 2021-04-04  6:38 UTC (permalink / raw)
  To: zsh-workers

I've pushed the patch for pattern.c.

> 2021/03/28 4:28, Lawrence Velázquez <vq@larryv.me> wrote:
> 
> On Mon, Jan 4, 2021, at 12:14 AM, Daniel Shahaf wrote:
>> Felipe Contreras wrote on Sat, 02 Jan 2021 12:30 -0600:
>>> The best fix is to allocate one byte, especially if it's going to be
>>> freed later on.
>> 
>> Yes, please revise the patch to allocate byte(s) from the heap as
>> needed.  (See comments at the top of mem.c, and, for instance,
>> dupstring() v. ztrdup().)
> 
> Any plans to send a revised patch?


utils.c is more complicated.

getkeystring() returns a pointer to a string allocated from heap if
GETKEY_SINGLE_CHAR is not set.

But if it is set, it tries to find a next character (possibly multibyte)
in the given string, and returns the pointer to the byte following
the found character in the string.
There is no problem (aside from the compiler warning) if it finds the
next character.

But getkeystring() does return the pointer to tmp[] if it can't find
a next character.

Currently, GETKEY_SINGLE_CHAR is used only in one place in the zsh
source code; line 850 in math.c, in function zzlex():

                    ptr = getkeystring(ptr, NULL, GETKEYS_MATH, &v);

    GETKEYS_MATH is defined as
	(GETKEY_OCTAL_ESC|GETKEY_EMACS|GETKEY_CTRL|GETKEY_SINGLE_CHAR)

The code is used for finding a character after ## in arithmetic evaluation.
For example,

% echo $((##\M))
0

in this case 'ptr' does points to tmp[], and continues to be used for
further parsing. Although it seems we do not get coredump, I think this
needs be fixed.

In the patch below, I modified getkeystring() to return NULL if it can't
find the next character, and math.h to check the return value.



diff --git a/Src/math.c b/Src/math.c
index b57ba42d4..1d0d86639 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -840,13 +840,18 @@ zzlex(void)
 	    if (*ptr == '#') {
 		if (*++ptr == '\\' || *ptr == '#') {
 		    int v;
+		    char *optr = ptr;
 
 		    ptr++;
 		    if (!*ptr) {
 			zerr("bad math expression: character missing after ##");
 			return EOI;
 		    }
-		    ptr = getkeystring(ptr, NULL, GETKEYS_MATH, &v);
+		    if(!(ptr = getkeystring(ptr, NULL, GETKEYS_MATH, &v))) {
+			zerr("bad math expression: bad character after ##");
+			ptr = optr;
+			return EOI;
+		    }
 		    yyval.u.l = v;
 		    return NUM;
 		}
diff --git a/Src/utils.c b/Src/utils.c
index 1ac064a4e..5a9222919 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -6697,13 +6697,21 @@ ucs4toutf8(char *dest, unsigned int wval)
  *
  * The return value is unmetafied unless GETKEY_DOLLAR_QUOTE is
  * in use.
+ *
+ * If GETKEY_SINGLE_CHAR is set in how, a next character in the given
+ * string is parsed, and the character code for it is returned in misc.
+ * The return value of the function is a pointer to the byte in the
+ * given string from where the next parsing should start. If the next
+ * character can't be found then NULL is returned.
+ * CAUTION: Currently, GETKEY_SINGLE_CHAR can be used only via
+ *          GETKEYS_MATH. Other use of it may cause trouble.
  */
 
 /**/
 mod_export char *
 getkeystring(char *s, int *len, int how, int *misc)
 {
-    char *buf, tmp[1];
+    char *buf = NULL, tmp[1];
     char *t, *tdest = NULL, *u = NULL, *sstart = s, *tbuf = NULL;
     char svchar = '\0';
     int meta = 0, control = 0, ignoring = 0;
@@ -6729,9 +6737,11 @@ getkeystring(char *s, int *len, int how, int *misc)
     DPUTS((how & (GETKEY_DOLLAR_QUOTE|GETKEY_SINGLE_CHAR)) ==
 	  (GETKEY_DOLLAR_QUOTE|GETKEY_SINGLE_CHAR),
 	  "BUG: incompatible options in getkeystring");
+    DPUTS((how & GETKEY_SINGLE_CHAR) && (how != GETKEYS_MATH),
+	  "BUG: unsupported options in getkeystring");
 
     if (how & GETKEY_SINGLE_CHAR)
-	t = buf = tmp;
+	t = tmp;
     else {
 	/* Length including terminating NULL */
 	int maxlen = 1;
@@ -7165,13 +7175,20 @@ getkeystring(char *s, int *len, int how, int *misc)
      */
     DPUTS((how & (GETKEY_DOLLAR_QUOTE|GETKEY_UPDATE_OFFSET)) ==
 	  GETKEY_DOLLAR_QUOTE, "BUG: unterminated $' substitution");
-    *t = '\0';
-    if (how & GETKEY_DOLLAR_QUOTE)
-	*tdest = '\0';
-    if (how & GETKEY_SINGLE_CHAR)
+
+    if (how & GETKEY_SINGLE_CHAR) {
+	/* couldn't find a character */
 	*misc = 0;
-    else
-	*len = ((how & GETKEY_DOLLAR_QUOTE) ? tdest : t) - buf;
+	return NULL;
+    }
+    if (how & GETKEY_DOLLAR_QUOTE) {
+	*tdest = '\0';
+	*len = tdest - buf;
+    }
+    else {
+	*t = '\0';
+	*len = t - buf;
+    }
     return buf;
 }
 







^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-04-03 15:44     ` Lawrence Velázquez
@ 2021-04-08 22:44       ` Oliver Kiddle
  2021-04-09  4:18         ` Jun T
  0 siblings, 1 reply; 21+ messages in thread
From: Oliver Kiddle @ 2021-04-08 22:44 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

On 3 Apr, Lawrence Velázquez wrote:
> > On Thu, Dec 31, 2020, at 12:41 AM, Felipe Contreras wrote:
> > > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> > > ---
> > >  aclocal.m4 |   8 ++---
> > >  aczsh.m4   | 104 ++++++++++++++++++++++++++---------------------------
> > >  2 files changed, 56 insertions(+), 56 deletions(-)

> > ping for review
> ppiinngg ffoorr rreevviieeww

Both this and the preceding part 1 patch look completely fine to me.
I've read through this and checked against a couple of different systems
and don't see an issue but I can't claim to be following what is new
with autoconf 2.70. Unless anyone sees a reason to object, I'll apply
these.

Thanks Felipe.

Oliver


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-04-08 22:44       ` Oliver Kiddle
@ 2021-04-09  4:18         ` Jun T
  2021-04-09 20:08           ` Oliver Kiddle
  0 siblings, 1 reply; 21+ messages in thread
From: Jun T @ 2021-04-09  4:18 UTC (permalink / raw)
  To: zsh-workers


> 2021/04/09 7:44, Oliver Kiddle <opk@zsh.org> wrote:
> 
> Both this and the preceding part 1 patch look completely fine to me.
> I've read through this and checked against a couple of different systems
> and don't see an issue but I can't claim to be following what is new
> with autoconf 2.70. Unless anyone sees a reason to object, I'll apply
> these.

I also tested on a few systems and fund no problems.

I think mem.c can be further simplified as follows (discard unnecessary macros):

PS
Are there any systems that still require --enable-zsh-mem?


diff --git a/Src/mem.c b/Src/mem.c
index 5951e57ed..fb4be47bf 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1072,19 +1072,6 @@ zrealloc(void *ptr, size_t size)
 # endif
 #endif
 
-#if defined(_BSD) && !defined(STDC_HEADERS)
-# define FREE_RET_T   int
-# define FREE_ARG_T   char *
-# define FREE_DO_RET
-# define MALLOC_RET_T char *
-# define MALLOC_ARG_T size_t
-#else
-# define FREE_RET_T   void
-# define FREE_ARG_T   void *
-# define MALLOC_RET_T void *
-# define MALLOC_ARG_T size_t
-#endif
-
 /* structure for building free list in blocks holding small blocks */
 
 struct m_shdr {
@@ -1198,8 +1185,8 @@ static struct m_hdr *m_l;
 
 #endif /* ZSH_MEM_DEBUG */
 
-MALLOC_RET_T
-malloc(MALLOC_ARG_T size)
+void *
+malloc(size_t size)
 {
     struct m_hdr *m, *mp, *mt;
     long n, s, os = 0;
@@ -1226,7 +1213,7 @@ malloc(MALLOC_ARG_T size)
 #if 1
 	size = 1;
 #else
-	return (MALLOC_RET_T) m_high;
+	return (void *) m_high;
 #endif
 
     queue_signals();  /* just queue signals rather than handling them */
@@ -1284,7 +1271,7 @@ malloc(MALLOC_ARG_T size)
 #endif
 
 	    unqueue_signals();
-	    return (MALLOC_RET_T) sh;
+	    return (void *) sh;
 	}
 	/* we still want a small block but there were no block with a free
 	   small block of the requested size; so we use the real allocation
@@ -1426,14 +1413,14 @@ malloc(MALLOC_ARG_T size)
 #endif
 
 	unqueue_signals();
-	return (MALLOC_RET_T) (((char *)m) + sizeof(struct m_hdr));
+	return (void *) (((char *)m) + sizeof(struct m_hdr));
     }
 #ifdef ZSH_MEM_DEBUG
     m_m[m->len < (1024 * M_ISIZE) ? (m->len / M_ISIZE) : 1024]++;
 #endif
 
     unqueue_signals();
-    return (MALLOC_RET_T) & m->next;
+    return (void *) & m->next;
 }
 
 /* this is an internal free(); the second argument may, but need not hold
@@ -1640,14 +1627,10 @@ zfree(void *p, int sz)
     unqueue_signals();
 }
 
-FREE_RET_T
-free(FREE_ARG_T p)
+void
+free(void *p)
 {
     zfree(p, 0);		/* 0 means: size is unknown */
-
-#ifdef FREE_DO_RET
-    return 0;
-#endif
 }
 
 /* this one is for strings (and only strings, real strings, real C strings,
@@ -1661,8 +1644,8 @@ zsfree(char *p)
 	zfree(p, strlen(p) + 1);
 }
 
-MALLOC_RET_T
-realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
+void *
+realloc(void *p, size_t size)
 {
     struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mt;
     char *r;
@@ -1673,12 +1656,12 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
 	queue_signals();
 	r = malloc(size);
 	unqueue_signals();
-	return (MALLOC_RET_T) r;
+	return (void *) r;
     }
 
     /* and some systems even do this... */
     if (!p || !size)
-	return (MALLOC_RET_T) p;
+	return p;
 
     queue_signals();  /* just queue signals caught rather than handling them */
 
@@ -1707,17 +1690,17 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
     free(p);
 
     unqueue_signals();
-    return (MALLOC_RET_T) r;
+    return (void *) r;
 }
 
-MALLOC_RET_T
-calloc(MALLOC_ARG_T n, MALLOC_ARG_T size)
+void *
+calloc(size_t n, size_t size)
 {
     long l;
     char *r;
 
     if (!(l = n * size))
-	return (MALLOC_RET_T) m_high;
+	return (void *) m_high;
 
     /*
      * use realloc() (with a NULL `p` argument it behaves exactly the same
@@ -1729,7 +1712,7 @@ calloc(MALLOC_ARG_T n, MALLOC_ARG_T size)
 
     memset(r, 0, l);
 
-    return (MALLOC_RET_T) r;
+    return (void *) r;
 }
 
 #ifdef ZSH_MEM_DEBUG




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-04-09  4:18         ` Jun T
@ 2021-04-09 20:08           ` Oliver Kiddle
  2021-04-09 20:28             ` Peter Stephenson
  0 siblings, 1 reply; 21+ messages in thread
From: Oliver Kiddle @ 2021-04-09 20:08 UTC (permalink / raw)
  To: zsh-workers

Jun T wrote:
> I also tested on a few systems and fund no problems.

Good. I've now applied them.

> I think mem.c can be further simplified as follows (discard unnecessary macros):

Yes, that does simplify it somewhat. No objections from me. But I'll
leave you to commit it.

> Are there any systems that still require --enable-zsh-mem?

I don't think I ever have needed it especially. I don't know if anyone
perhaps finds it useful for debug capabilities though some of the common
malloc implementations probably have better functionality for that
anyway. Cutting away some of this old stuff from the zsh code base may
make it easier to maintain. So again, no objections from me but in this
case there may be others with an interest in keeping it.

Oliver


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-04-09 20:08           ` Oliver Kiddle
@ 2021-04-09 20:28             ` Peter Stephenson
  2021-04-09 23:04               ` Bart Schaefer
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Stephenson @ 2021-04-09 20:28 UTC (permalink / raw)
  To: zsh-workers

On Fri, 2021-04-09 at 22:08 +0200, Oliver Kiddle wrote:
> > Are there any systems that still require --enable-zsh-mem?
> 
> I don't think I ever have needed it especially. I don't know if anyone
> perhaps finds it useful for debug capabilities though some of the common
> malloc implementations probably have better functionality for that
> anyway. Cutting away some of this old stuff from the zsh code base may
> make it easier to maintain. So again, no objections from me but in this
> case there may be others with an interest in keeping it.

I wonder if we might even struggle to find anyone who still uses it.
It was well-maintained a long time ago, but has had virtually no
attention since.  Unless you've been around these parts a couple of
decades, you might not be more than vaguely aware of it.

pws



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-04-09 20:28             ` Peter Stephenson
@ 2021-04-09 23:04               ` Bart Schaefer
  2021-04-09 23:19                 ` Mikael Magnusson
  2021-04-10  0:37                 ` Jun. T
  0 siblings, 2 replies; 21+ messages in thread
From: Bart Schaefer @ 2021-04-09 23:04 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

RE --enable-zsh-mem ... I haven't used it in a long time, and if I did
it would be for debugging.

RE autoconf 2.70 -- is this patch set going to mean I can't build zsh
from git checkout on my ubuntu box with autoconf 2.69 ?  That would
make me sad.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-04-09 23:04               ` Bart Schaefer
@ 2021-04-09 23:19                 ` Mikael Magnusson
  2021-04-10  0:37                 ` Jun. T
  1 sibling, 0 replies; 21+ messages in thread
From: Mikael Magnusson @ 2021-04-09 23:19 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Peter Stephenson, Zsh hackers list

On 4/10/21, Bart Schaefer <schaefer@brasslantern.com> wrote:
> RE --enable-zsh-mem ... I haven't used it in a long time, and if I did
> it would be for debugging.

I remember a few bugs in the past that were easier/only possible to
debug with zsh-mem/debug enabled, so if it isn't broken I don't see a
reason to remove it for now.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/3] autoconf: prepare for 2.70
  2021-04-09 23:04               ` Bart Schaefer
  2021-04-09 23:19                 ` Mikael Magnusson
@ 2021-04-10  0:37                 ` Jun. T
  1 sibling, 0 replies; 21+ messages in thread
From: Jun. T @ 2021-04-10  0:37 UTC (permalink / raw)
  To: zsh-workers


> 2021/04/10 8:04, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> RE autoconf 2.70 -- is this patch set going to mean I can't build zsh
> from git checkout on my ubuntu box with autoconf 2.69 ? 

With the patch zsh can be built file either with autconf 2.69 or 2.71
(I didn't try 2.7).



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-04-10  0:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-31  5:41 [PATCH 0/3] Build fixes Felipe Contreras
2020-12-31  5:41 ` [PATCH 1/3] src: fix build warnings Felipe Contreras
2021-01-02 11:22   ` Daniel Shahaf
2021-01-02 16:41     ` Mikael Magnusson
2021-01-02 18:30       ` Felipe Contreras
2021-01-04  5:14         ` Daniel Shahaf
2021-03-27 19:28           ` Lawrence Velázquez
2021-04-04  6:38             ` Jun. T
2020-12-31  5:41 ` [PATCH 2/3] autoconf: remove deprecated functions Felipe Contreras
2021-03-27 19:37   ` Lawrence Velázquez
2021-04-03 15:04     ` Lawrence Velázquez
2020-12-31  5:41 ` [PATCH 3/3] autoconf: prepare for 2.70 Felipe Contreras
2021-03-27 19:38   ` Lawrence Velázquez
2021-04-03 15:44     ` Lawrence Velázquez
2021-04-08 22:44       ` Oliver Kiddle
2021-04-09  4:18         ` Jun T
2021-04-09 20:08           ` Oliver Kiddle
2021-04-09 20:28             ` Peter Stephenson
2021-04-09 23:04               ` Bart Schaefer
2021-04-09 23:19                 ` Mikael Magnusson
2021-04-10  0:37                 ` Jun. T

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