History log of /bionic/libc/include/assert.h
Revision Date Author Comments
ff26a16c1de7be696719e9001f0707b7c55b52cf 18-Aug-2017 Elliott Hughes <enh@google.com> Re-submit "Name function arguments in libc headers for Studio."

This reverts commit 9af9120091ceb96641d7c6c645fabad96db4bc0d (a revert
of 079bff4fa52b0c3c76057451cc9cdecf1827fce0), now the versioner bug is
fixed.

Bug: http://b/64613623 # header bug
Bug: http://b/64802958 # versioner bug
Change-Id: I1cb9d7832d4b3aecdc57a9285e2291443e59d02d
9af9120091ceb96641d7c6c645fabad96db4bc0d 17-Aug-2017 Colin Cross <ccross@android.com> Revert "Name function arguments in libc headers for Studio."

This reverts commit 079bff4fa52b0c3c76057451cc9cdecf1827fce0.

Broke builds with SANITIZE_HOST=address with an asan failure in versioner.

Change-Id: I22b113fd5405589d1a25e5e137c450aaba1ade5f
079bff4fa52b0c3c76057451cc9cdecf1827fce0 17-Aug-2017 Elliott Hughes <enh@google.com> Name function arguments in libc headers for Studio.

Second batch of headers...

Bug: http://b/64613623
Test: builds
Change-Id: I8eef043dbf32afee8ff814e9d005f46aee8fa21f
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