]> git.ipfire.org Git - thirdparty/libvirt.git/commit
sa_assert: assert-like macro, enabled only for use with static analyzers
authorJim Meyering <meyering@redhat.com>
Wed, 7 Apr 2010 14:13:17 +0000 (16:13 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 14 Apr 2010 18:10:18 +0000 (20:10 +0200)
commite078fa3cecd4bb3303a1735a45723c9a2d9adec2
treefb094711e77cd406ffd26d92ad841330c513375b
parentcffe619bdf9943282cc9f6a0cf815ad9f0fe7fd7
sa_assert: assert-like macro, enabled only for use with static analyzers

Among some here, there is a strong aversion to the use of "assert", yet
some others think it is essential (when applied judiciously) even --
perhaps "especially" -- at the heart of libraries and core hypervisor-
related code.
Here is a compromise that lets us make assertions about the code (e.g.,
to tell static analyzers about invariants) without even a hint of risk
of an abort.
* src/internal.h [STATIC_ANALYSIS]: Include <assert.h>.
(sa_assert): Define.  A no-op most of the time, but equivalent
to classical assert when STATIC_ANALYSIS is nonzero.
src/internal.h