summaryrefslogtreecommitdiffstats
path: root/src/test.cc
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-04-21 00:29:00 (GMT)
committerDan Willemsen <dwillemsen@google.com>2016-04-21 01:24:10 (GMT)
commitd4607eb8974a0fcd034ba6d93624544815788ff2 (patch)
treeef68881c84ebc830cb678c48dba93aceb12b9947 /src/test.cc
parent73b672ebbf1a28227b070f1f3191c9fd51d8e3ad (diff)
downloadNinja-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/test.cc')
-rw-r--r--src/test.cc1
1 files changed, 1 insertions, 0 deletions
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