f6495c78a84b4a797a6faf77f8bd56998c739509 |
|
25-Jul-2016 |
Elliott Hughes <enh@google.com> |
Stop #define'ing __func__ and __restrict. __STDC_VERSION__ isn't defined for __cplusplus, so we've been removing such checks. Some got missed. Stop defining __func__ and just use the __PRETTY_FUNCTION__ GCC extension in <assert.h>. Also fix the #if there so that C++ gets __assert2 rather than __assert, and rewrite the cast to work with -I rather than -isystem. Also remove __restrict and just always use the __restrict GCC extension. Add a trivial test for <assert.h>. Bug: http://b/30353757 Change-Id: Ie49bb417976293d3a9692b516e28fe3c0ae0a6d9 Test: ran bionic unit tests.
|
3ba55f8022f3d5c5ca94a3df46fa658eda791987 |
|
09-Jun-2016 |
Elliott Hughes <enh@google.com> |
Rationalize visibility. If it's C or POSIX, it's in. If it's BSD or GNU, it's guarded by __USE_BSD or __USE_GNU. Bug: https://code.google.com/p/android/issues/detail?id=194631 Change-Id: Ife51a21c2b37b060db56780d29c929805b199cb6
|
409e48add1e9ec6189efbf32c376c1c90c7e186d |
|
08-Jun-2016 |
Elliott Hughes <enh@google.com> |
More C compatibility. Add C11 static_assert to <assert.h>. Remove uses of __dead while we're there: __noreturn already does the same thing on those functions. Fix <uchar.h> so it works from C. <stdalign.h> and <stdnoreturn.h> are provided by clang, so there's nothing for us to do. Bug: http://b/29178582 Change-Id: Iebc46223868729a26d1a61eb125b76cbcb83a22d
|
323d4b6f6839b472ac02c31105727147660dc4db |
|
13-Jan-2014 |
Vadim Markovtsev <gmarkhor@gmail.com> |
Add "__noreturn" to assert and assert2 These functions should print assertion violation messages and then call abort(). They do really not return control flow afterwards. Consider the declaration of the similar __assert_fail from glibc: extern void __assert_fail (const char *__assertion, const char *__file, unsigned int __line, const char *__function) __THROW __attribute__ ((__noreturn__)); Bionic has __noreturn defined in sys/cdefs.h to be that GNU noreturn attribute. This patch has a practical value. Consider the following function: void check(void* ptr) { assert(ptr != NULL); } Without this patch applied, gcc (and presumably clang) shows even in debug mode: warning: unused parameter 'ptr' [-Wunused-parameter] In release mode, NDEBUG is defined and assert() becomes a no-op, as one should expect. Thus, the warning is shown correctly then. Another code sample: float array[2]; int i = 3; ... assert(i < 2); array[i] = 0; gcc says, warning: array subscript is below array bounds [-Warray-bounds] In other words, without noreturn attribute, assertions do not allow a compiler's static analyzer to properly understand the preconditions. Change-Id: I3be92e99787c528899cf243ed448c4730c00c45b Signed-off-by: Vadim Markovtsev <gmarkhor@gmail.com>
|
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 |
|
04-Mar-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //depot/cupcake/@135843
|
1767f908af327fa388b1c66883760ad851267013 |
|
04-Mar-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //depot/cupcake/@135843
|
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 |
|
21-Oct-2008 |
The Android Open Source Project <initial-contribution@android.com> |
Initial Contribution
|