diff options
author | Martin Liska <mliska@suse.cz> | 2022-08-09 13:59:32 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-08-10 13:12:22 +0200 |
commit | 1270ccda70ca09f7d4fe76b5156dca8992bd77a6 (patch) | |
tree | 5fbcd89444a2b5818dc7acd95ea421a783bd3b7c /gcc/gcc.cc | |
parent | c16d9f78dc81664e3341157c5a6efb85c0c141f4 (diff) | |
download | gcc-1270ccda70ca09f7d4fe76b5156dca8992bd77a6.zip gcc-1270ccda70ca09f7d4fe76b5156dca8992bd77a6.tar.gz gcc-1270ccda70ca09f7d4fe76b5156dca8992bd77a6.tar.bz2 |
Factor out jobserver_active_p.
gcc/ChangeLog:
* gcc.cc (driver::detect_jobserver): Remove and move to
jobserver.h.
* lto-wrapper.cc (jobserver_active_p): Likewise.
(run_gcc): Likewise.
* opts-jobserver.h: New file.
* opts-common.cc (jobserver_info::jobserver_info): New function.
Diffstat (limited to 'gcc/gcc.cc')
-rw-r--r-- | gcc/gcc.cc | 37 |
1 files changed, 5 insertions, 32 deletions
@@ -27,6 +27,7 @@ CC recognizes how to compile each input file by suffixes in the file names. Once it knows which kind of compilation to perform, the procedure for compilation is specified by a string called a "spec". */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" @@ -43,6 +44,7 @@ compilation is specified by a string called a "spec". */ #include "opts.h" #include "filenames.h" #include "spellcheck.h" +#include "opts-jobserver.h" @@ -9178,38 +9180,9 @@ driver::final_actions () const void driver::detect_jobserver () const { - /* Detect jobserver and drop it if it's not working. */ - const char *makeflags = env.get ("MAKEFLAGS"); - if (makeflags != NULL) - { - const char *needle = "--jobserver-auth="; - const char *n = strstr (makeflags, needle); - if (n != NULL) - { - int rfd = -1; - int wfd = -1; - - bool jobserver - = (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2 - && rfd > 0 - && wfd > 0 - && is_valid_fd (rfd) - && is_valid_fd (wfd)); - - /* Drop the jobserver if it's not working now. */ - if (!jobserver) - { - unsigned offset = n - makeflags; - char *dup = xstrdup (makeflags); - dup[offset] = '\0'; - - const char *space = strchr (makeflags + offset, ' '); - if (space != NULL) - strcpy (dup + offset, space); - xputenv (concat ("MAKEFLAGS=", dup, NULL)); - } - } - } + jobserver_info jinfo; + if (!jinfo.is_active && !jinfo.skipped_makeflags.empty ()) + xputenv (jinfo.skipped_makeflags.c_str ()); } /* Determine what the exit code of the driver should be. */ |