+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
/* 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. */
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)