diff options
| author | Mattias EngdegÄrd | 2022-02-10 22:59:26 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-02-10 23:06:17 +0100 |
| commit | 26eeca71fbb3ee76ad51d3b83b79992f165e5f06 (patch) | |
| tree | 46a8ec47a90a24412892c793918cb188af18ea61 /src | |
| parent | 437382734a53e8fb311938d5dd8a39508e60b9bf (diff) | |
| download | emacs-26eeca71fbb3ee76ad51d3b83b79992f165e5f06.tar.gz emacs-26eeca71fbb3ee76ad51d3b83b79992f165e5f06.zip | |
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')
| -rw-r--r-- | src/callproc.c | 2 | ||||
| -rw-r--r-- | src/conf_post.h | 13 | ||||
| -rw-r--r-- | src/sysdep.c | 2 |
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, | |||
| 1500 | if (pty != NULL) | 1500 | if (pty != NULL) |
| 1501 | pid = fork (); | 1501 | pid = fork (); |
| 1502 | else | 1502 | else |
| 1503 | pid = vfork (); | 1503 | pid = VFORK (); |
| 1504 | #else | 1504 | #else |
| 1505 | pid = vfork (); | 1505 | pid = vfork (); |
| 1506 | #endif | 1506 | #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 *); | |||
| 353 | # define vfork fork | 353 | # define vfork fork |
| 354 | #endif | 354 | #endif |
| 355 | 355 | ||
| 356 | /* vfork is deprecated on at least macOS 11.6 and later, but it still works | ||
| 357 | and is faster than fork, so silence the warning as if we knew what we | ||
| 358 | are doing. */ | ||
| 359 | #ifdef DARWIN_OS | ||
| 360 | #define VFORK() \ | ||
| 361 | (_Pragma("clang diagnostic push") \ | ||
| 362 | _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \ | ||
| 363 | vfork () \ | ||
| 364 | _Pragma("clang diagnostic pop")) | ||
| 365 | #else | ||
| 366 | #define VFORK() vfork () | ||
| 367 | #endif | ||
| 368 | |||
| 356 | #if ! (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__) | 369 | #if ! (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__) |
| 357 | # undef PROFILING | 370 | # undef PROFILING |
| 358 | #endif | 371 | #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) | |||
| 664 | #else | 664 | #else |
| 665 | { | 665 | { |
| 666 | char *volatile str_volatile = str; | 666 | char *volatile str_volatile = str; |
| 667 | pid = vfork (); | 667 | pid = VFORK (); |
| 668 | str = str_volatile; | 668 | str = str_volatile; |
| 669 | } | 669 | } |
| 670 | #endif | 670 | #endif |