aboutsummaryrefslogtreecommitdiff
path: root/libstdc++
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-07-27 17:40:29 -0700
committerElliott Hughes <enh@google.com>2012-07-27 17:43:38 -0700
commit52d6233296ec84eb5b58fcbf7bc9da4b96a943aa (patch)
treeb0186ce62c2aedc309501f0bfc641a291d91d3e6 /libstdc++
parenta7916509a3446afd0e863b03e4204cee73e81555 (diff)
downloadbionic-52d6233296ec84eb5b58fcbf7bc9da4b96a943aa.tar.gz
Report errors to the log, not just stderr.
In particular this affects assert(3) and __cxa_pure_virtual, both of which have managed to confuse people this week by apparently aborting without reason. (Because stderr goes nowhere, normally.) Bug: 6852995 Bug: 6840813 Change-Id: I7f5d17d5ddda439e217b7932096702dc013b9142
Diffstat (limited to 'libstdc++')
-rw-r--r--libstdc++/Android.mk2
-rw-r--r--libstdc++/src/one_time_construction.cpp4
-rw-r--r--libstdc++/src/pure_virtual.cpp14
3 files changed, 9 insertions, 11 deletions
diff --git a/libstdc++/Android.mk b/libstdc++/Android.mk
index 8bc181f55..7d27aa865 100644
--- a/libstdc++/Android.mk
+++ b/libstdc++/Android.mk
@@ -3,7 +3,7 @@ LOCAL_PATH:= $(call my-dir)
# Common C++ flags to build this library.
# Note that we need to access private Bionic headers
# and define ANDROID_SMP accordingly.
-libstdc++_cflags := -Ibionic/libc/private
+libstdc++_cflags := -Ibionic/libc/
ifeq ($(TARGET_CPU_SMP),true)
libstdc++_cflags += -DANDROID_SMP=1
else
diff --git a/libstdc++/src/one_time_construction.cpp b/libstdc++/src/one_time_construction.cpp
index 1eac3b1a5..3cfb2139f 100644
--- a/libstdc++/src/one_time_construction.cpp
+++ b/libstdc++/src/one_time_construction.cpp
@@ -11,8 +11,8 @@
#include <stddef.h>
#include <sys/atomics.h>
#include <endian.h>
-#include <bionic_futex.h>
-#include <bionic_atomic_inline.h>
+#include <private/bionic_futex.h>
+#include <private/bionic_atomic_inline.h>
// ARM C++ ABI and Itanium/x86 C++ ABI has different definition for
// one time construction:
diff --git a/libstdc++/src/pure_virtual.cpp b/libstdc++/src/pure_virtual.cpp
index 663c1e996..affb80fcc 100644
--- a/libstdc++/src/pure_virtual.cpp
+++ b/libstdc++/src/pure_virtual.cpp
@@ -1,10 +1,8 @@
+#undef NDEBUG
+#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-extern "C" void __cxa_pure_virtual()
-{
- fprintf(stderr, "Pure virtual function called. Are you calling virtual methods from a destructor?\n");
- abort();
+extern "C" void __cxa_pure_virtual() {
+ // We can't call __libc_android_log_write from libstdc++ because it's private, so cheat.
+ assert(!"Pure virtual function called. Are you calling virtual methods from a destructor?");
+ /* NOTREACHED */
}
-