summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/callproc.c2
-rw-r--r--src/conf_post.h13
-rw-r--r--src/sysdep.c2
3 files changed, 15 insertions, 2 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 4d3b0bb8e06..dcee740043c 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1500,7 +1500,7 @@ emacs_spawn (pid_t *newpid, int std_in, int std_out, int std_err,
if (pty != NULL)
pid = fork ();
else
- pid = vfork ();
+ pid = VFORK ();
#else
pid = vfork ();
#endif
diff --git a/src/conf_post.h b/src/conf_post.h
index 6db76a2dfad..0b6260b287e 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -353,6 +353,19 @@ extern int emacs_setenv_TZ (char const *);
# define vfork fork
#endif
+/* vfork is deprecated on at least macOS 11.6 and later, but it still works
+ and is faster than fork, so silence the warning as if we knew what we
+ are doing. */
+#ifdef DARWIN_OS
+#define VFORK() \
+ (_Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
+ vfork () \
+ _Pragma("clang diagnostic pop"))
+#else
+#define VFORK() vfork ()
+#endif
+
#if ! (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)
# undef PROFILING
#endif
diff --git a/src/sysdep.c b/src/sysdep.c
index d682e87cc71..c772aff6a02 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -664,7 +664,7 @@ sys_subshell (void)
#else
{
char *volatile str_volatile = str;
- pid = vfork ();
+ pid = VFORK ();
str = str_volatile;
}
#endif