Date: Sun, 1 Mar 2009 09:35:41 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/sys/sys vimage.h Message-ID: <200903010935.n219ZpxC063211@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
bz 2009-03-01 09:35:41 UTC FreeBSD src repository Modified files: sys/sys vimage.h Log: SVN rev 189221 on 2009-03-01 09:35:41Z by bz 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) Revision Changes Path 1.9 +24 -0 src/sys/sys/vimage.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903010935.n219ZpxC063211>