Provide warning for missing jobserver.
PR driver/94330 * lto-wrapper.c (run_gcc): When using -flto=jobserver, report warning when the jobserver is not detected.
This commit is contained in:
parent
af2311abf8
commit
0f62caf58b
|
@ -1,3 +1,9 @@
|
|||
2020-05-05 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR driver/94330
|
||||
* lto-wrapper.c (run_gcc): When using -flto=jobserver,
|
||||
report warning when the jobserver is not detected.
|
||||
|
||||
2020-05-05 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR gcov-profile/94636
|
||||
|
|
|
@ -1236,28 +1236,33 @@ init_num_threads (void)
|
|||
|
||||
/* FIXME: once using -std=c++11, we can use std::thread::hardware_concurrency. */
|
||||
|
||||
/* Return true when a jobserver is running and can accept a job. */
|
||||
/* Test and return reason why a jobserver cannot be detected. */
|
||||
|
||||
static bool
|
||||
static const char *
|
||||
jobserver_active_p (void)
|
||||
{
|
||||
#define JS_PREFIX "jobserver is not available: "
|
||||
#define JS_NEEDLE "--jobserver-auth="
|
||||
|
||||
const char *makeflags = getenv ("MAKEFLAGS");
|
||||
if (makeflags == NULL)
|
||||
return false;
|
||||
return JS_PREFIX "%<MAKEFLAGS%> environment variable is unset";
|
||||
|
||||
const char *needle = "--jobserver-auth=";
|
||||
const char *n = strstr (makeflags, needle);
|
||||
const char *n = strstr (makeflags, JS_NEEDLE);
|
||||
if (n == NULL)
|
||||
return false;
|
||||
return JS_PREFIX "%<" JS_NEEDLE "%> is not present in %<MAKEFLAGS%>";
|
||||
|
||||
int rfd = -1;
|
||||
int wfd = -1;
|
||||
|
||||
return (sscanf (n + strlen (needle), "%d,%d", &rfd, &wfd) == 2
|
||||
&& rfd > 0
|
||||
&& wfd > 0
|
||||
&& is_valid_fd (rfd)
|
||||
&& is_valid_fd (wfd));
|
||||
if (sscanf (n + strlen (JS_NEEDLE), "%d,%d", &rfd, &wfd) == 2
|
||||
&& rfd > 0
|
||||
&& wfd > 0
|
||||
&& is_valid_fd (rfd)
|
||||
&& is_valid_fd (wfd))
|
||||
return NULL;
|
||||
else
|
||||
return JS_PREFIX "cannot access %<" JS_NEEDLE "%> file descriptors";
|
||||
}
|
||||
|
||||
/* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
|
||||
|
@ -1473,10 +1478,16 @@ run_gcc (unsigned argc, char *argv[])
|
|||
auto_parallel = 0;
|
||||
parallel = 0;
|
||||
}
|
||||
else if (!jobserver && jobserver_active_p ())
|
||||
else
|
||||
{
|
||||
parallel = 1;
|
||||
jobserver = 1;
|
||||
const char *jobserver_error = jobserver_active_p ();
|
||||
if (jobserver && jobserver_error != NULL)
|
||||
warning (0, jobserver_error);
|
||||
else if (!jobserver && jobserver_error == NULL)
|
||||
{
|
||||
parallel = 1;
|
||||
jobserver = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (linker_output)
|
||||
|
|
Loading…
Reference in New Issue