aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-03-15 15:27:13 -0700
committerElliott Hughes <enh@google.com>2018-03-15 15:27:13 -0700
commitbbaff93af4be14829a3c990faf48f77536588d19 (patch)
tree4386dba1f49114ee9389e345f62cfbed4517dcd4
parent381321633d20a756ac4cf21e95302f38639df560 (diff)
downloadndk-bbaff93af4be14829a3c990faf48f77536588d19.tar.gz
Add nullptr_t to the "system STL"'s <cstddef>.
Bug: http://b/65466378 Test: test builds Change-Id: Id9693ae4749d15b01a0f04d32f3b790bd089c5a8
-rw-r--r--sources/cxx-stl/system/include/cstddef19
-rw-r--r--tests/build/system-cpp-headers/jni/Application.mk3
-rw-r--r--tests/build/system-cpp-headers/jni/main.cpp6
3 files changed, 15 insertions, 13 deletions
diff --git a/sources/cxx-stl/system/include/cstddef b/sources/cxx-stl/system/include/cstddef
index cb06b49c8..91fb7af00 100644
--- a/sources/cxx-stl/system/include/cstddef
+++ b/sources/cxx-stl/system/include/cstddef
@@ -1,4 +1,3 @@
-/* -*- c++ -*- */
/*
* Copyright (C) 2009 The Android Open Source Project
* All rights reserved.
@@ -30,21 +29,21 @@
#ifndef BIONIC_LIBSTDCPP_INCLUDE_CSTDDEF__
#define BIONIC_LIBSTDCPP_INCLUDE_CSTDDEF__
-/*
- * Standard C++ Library wrapper around the C stddef.h header file.
- * The following 2 types are also declared in the 'std' namespace:
- * . ptrdiff_t
- * . size_t
- */
#include <stddef.h>
extern "C++" {
namespace std {
+
using ::ptrdiff_t;
using ::size_t;
-} // namespace std
-} // extern C++
+#if __cplusplus >= 201103L
+typedef decltype(nullptr) nullptr_t;
+#endif
+
+}
+
+}
-#endif // BIONIC_LIBSTDCPP_INCLUDE_CSTDDEF__
+#endif
diff --git a/tests/build/system-cpp-headers/jni/Application.mk b/tests/build/system-cpp-headers/jni/Application.mk
index 7a8e91af5..7c70c88d1 100644
--- a/tests/build/system-cpp-headers/jni/Application.mk
+++ b/tests/build/system-cpp-headers/jni/Application.mk
@@ -1,2 +1,3 @@
APP_STL := none
-APP_PLATFORM := android-3
+APP_PLATFORM := android-16
+APP_CPPFLAGS := -std=c++11
diff --git a/tests/build/system-cpp-headers/jni/main.cpp b/tests/build/system-cpp-headers/jni/main.cpp
index 81b71cd32..a7c96e3f8 100644
--- a/tests/build/system-cpp-headers/jni/main.cpp
+++ b/tests/build/system-cpp-headers/jni/main.cpp
@@ -1,5 +1,3 @@
-// Check that including <cstdlib> doesn't result in a build error
-// with API level 3.
#include <cassert>
#include <cctype>
#include <cerrno>
@@ -20,6 +18,10 @@
#include <typeinfo>
#include <utility>
+class C {
+ C(std::nullptr_t ) {}
+};
+
int main(void) {
return 0;
}