summaryrefslogtreecommitdiff
path: root/src/conf_post.h
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-02-10 22:59:26 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2022-02-10 23:06:17 +0100
commit26eeca71fbb3ee76ad51d3b83b79992f165e5f06 (patch)
tree46a8ec47a90a24412892c793918cb188af18ea61 /src/conf_post.h
parent437382734a53e8fb311938d5dd8a39508e60b9bf (diff)
downloademacs-26eeca71fbb3ee76ad51d3b83b79992f165e5f06.tar.gz
Silence macOS vfork deprecation warnings
The vfork system call exists and works in macOS 11.6 but the compiler gives a deprecation message; silence it, because the performance is still better than that of plain fork. See discussion at https://lists.gnu.org/archive/html/emacs-devel/2022-02/msg00260.html * src/conf_post.h (VFORK): New #define. * src/callproc.c (emacs_spawn): * src/sysdep.c (sys_subshell): Use it.
Diffstat (limited to 'src/conf_post.h')
-rw-r--r--src/conf_post.h13
1 files changed, 13 insertions, 0 deletions
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