diff options
author | Dan Willemsen <dwillemsen@google.com> | 2016-04-21 00:29:00 (GMT) |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2016-04-21 01:24:10 (GMT) |
commit | d4607eb8974a0fcd034ba6d93624544815788ff2 (patch) | |
tree | ef68881c84ebc830cb678c48dba93aceb12b9947 /src | |
parent | 73b672ebbf1a28227b070f1f3191c9fd51d8e3ad (diff) | |
download | Ninja-d4607eb8974a0fcd034ba6d93624544815788ff2.zip Ninja-d4607eb8974a0fcd034ba6d93624544815788ff2.tar.gz Ninja-d4607eb8974a0fcd034ba6d93624544815788ff2.tar.bz2 |
Add <stdlib.h> includes for clang++/libc++ on Ubuntu
There are a number of stdlib.h uses in these files without including
stdlib.h:
hash_collision_bench.cc: rand, RAND_MAX, srand
manifest_parser_perftest.cc: system, exit
ninja_test.cc: EXIT_SUCCESS, EXIT_FAILURE
test.cc: getenv, mkdtemp, system
This works on a Ubuntu g++/libstdc++ build, as the <algorithm> header
pulls in stdlib.h, and on a OSX clang++/libc++ build the <map> and
<string> headers pull in stdlib.h. But a Ubuntu clang++/libc++ build
does not pull in stdlib.h with any of these other headers.
$ apt-get install clang-3.6 libc++-dev
$ CXX=clang++-3.6 CFLAGS=-stdlib=libc++ LDFLAGS=-stdlib=libc++ \
./configure.py
$ ninja ninja_test hash_collision_bench manifest_parser_perftest
This was originally discovered using the host toolchain provided with
Android, but the Ubuntu version is much easier to reproduce.
Diffstat (limited to 'src')
-rw-r--r-- | src/hash_collision_bench.cc | 1 | ||||
-rw-r--r-- | src/manifest_parser_perftest.cc | 1 | ||||
-rw-r--r-- | src/ninja_test.cc | 1 | ||||
-rw-r--r-- | src/test.cc | 1 |
4 files changed, 4 insertions, 0 deletions
diff --git a/src/hash_collision_bench.cc b/src/hash_collision_bench.cc index 5be0531..ff947dc 100644 --- a/src/hash_collision_bench.cc +++ b/src/hash_collision_bench.cc @@ -17,6 +17,7 @@ #include <algorithm> using namespace std; +#include <stdlib.h> #include <time.h> int random(int low, int high) { diff --git a/src/manifest_parser_perftest.cc b/src/manifest_parser_perftest.cc index 572e2d5..60c2054 100644 --- a/src/manifest_parser_perftest.cc +++ b/src/manifest_parser_perftest.cc @@ -19,6 +19,7 @@ #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #ifdef _WIN32 diff --git a/src/ninja_test.cc b/src/ninja_test.cc index 11087b6..d642c5c 100644 --- a/src/ninja_test.cc +++ b/src/ninja_test.cc @@ -14,6 +14,7 @@ #include <stdarg.h> #include <stdio.h> +#include <stdlib.h> #ifdef _WIN32 #include "getopt.h" diff --git a/src/test.cc b/src/test.cc index 53bfc48..51882f0 100644 --- a/src/test.cc +++ b/src/test.cc @@ -21,6 +21,7 @@ #include <algorithm> #include <errno.h> +#include <stdlib.h> #ifdef _WIN32 #include <windows.h> #else |