diff options
author | bz <bz@FreeBSD.org> | 2009-03-01 09:35:41 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2009-03-01 09:35:41 +0000 |
commit | 1e29cb8e989182b94c8c02afa8d424cc7c2d5f46 (patch) | |
tree | 066a6ca794959afe7fec3e11bb73251e1f9ed6c3 /lib/libc/stdlib/rand.c | |
parent | 3ca562853b0699e99081db9aa90c0f1b9cbd1cbb (diff) | |
download | FreeBSD-src-1e29cb8e989182b94c8c02afa8d424cc7c2d5f46.zip FreeBSD-src-1e29cb8e989182b94c8c02afa8d424cc7c2d5f46.tar.gz |
Add the new compile-time assertion macro CTASSERT_EQUAL().
It takes a positive integer constant (the expected value) and
another positive integer, usually compile-time evaluated,
e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo));
While the classic CTASSERT() gives:
error: size of array '__assert60' is negative
this gives you:
In function '__ctassert_equal_at_line_60':
warning: '__expected_42_but_got[464ul]' is used uninitialized in this function
and you can directly see the difference in the expected and the
real value.
CTASSERT_EQUAL() needs special compile time options to trigger
thus keep it locally to this header. If it proves to be of general
interest it can be moved to systm.h.
Submitted by: jmallett
Reviewed by: sam, warner, rwatson, jmallett (earlier versions)
Diffstat (limited to 'lib/libc/stdlib/rand.c')
0 files changed, 0 insertions, 0 deletions