On 25/05/21 10:37 +0200, Jakub Jelinek wrote:
Hi!

This TU uses exit, but doesn't include <stdlib.h> or <cstdlib> and relies
on some other header to include it indirectly, which apparently doesn't
happen on reporter's host.

The other <c*> headers aren't guarded either and we rely on a compiler
capable of C++11, so maybe we can rely on <cstdlib> being around
unconditionally.

<cstdlib> is required since C++98 anyway, as is std::exit.

But it's incorrect to include <cstdlib> and then use ::exit, it should
be <cstdlib> and std::exit, or <stdlib.h> and ::exit. But it probably
works everywhere this way too.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/11?

2021-05-25  Jakub Jelinek  <ja...@redhat.com>

        PR bootstrap/100731
        * server.cc: Include <cstdlib>.

--- c++tools/server.cc.jj       2021-05-24 14:20:01.905748402 +0200
+++ c++tools/server.cc  2021-05-24 14:24:29.760813389 +0200
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3.
#include <csignal>
#include <cstring>
#include <cstdarg>
+#include <cstdlib>
// OS
#include <unistd.h>
#include <sys/types.h>

        Jakub

Reply via email to