mirror of
https://github.com/pulseaudio/pulseaudio.git
synced 2024-11-23 01:47:17 +08:00
build: Add Coverity scan model
the modeling file help to avoid false positives and increase scanning accuracy by explaining code Coverity can't see (out of tree libraries); the model file must be uploaded by an admin to: https://scan.coverity.com/projects/pulseaudio?tab=analysis_settings the pa_assert_se() macro needs to be rewritten for Coverity so that the assignment is not declared a side-effect Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
This commit is contained in:
parent
e368ee4875
commit
424e97a5fa
18
coverity/model.c
Normal file
18
coverity/model.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* Coverity Scan model
|
||||
* Copyright (C) 2017 Peter Meerwald-Stadler <pmeerw@pmeerw.net>
|
||||
*
|
||||
* This is a modeling file for Coverity Scan which helps to avoid false
|
||||
* positives and increase scanning accuracy by explaining code Coverity
|
||||
* can't see (out of tree libraries); the model file must be uploaded by
|
||||
* an admin to:
|
||||
* https://scan.coverity.com/projects/pulseaudio?tab=analysis_settings
|
||||
*/
|
||||
|
||||
void fail(void) {
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
||||
void fail_unless(int x) {
|
||||
if (!x)
|
||||
__coverity_panic__();
|
||||
}
|
@ -186,6 +186,7 @@ static inline size_t PA_ALIGN(size_t l) {
|
||||
|
||||
/* pa_assert_se() is an assert which guarantees side effects of x,
|
||||
* i.e. is never optimized away, regardless of NDEBUG or FASTPATH. */
|
||||
#ifndef __COVERITY__
|
||||
#define pa_assert_se(expr) \
|
||||
do { \
|
||||
if (PA_UNLIKELY(!(expr))) { \
|
||||
@ -193,6 +194,14 @@ static inline size_t PA_ALIGN(size_t l) {
|
||||
abort(); \
|
||||
} \
|
||||
} while (false)
|
||||
#else
|
||||
#define pa_assert_se(expr) \
|
||||
do { \
|
||||
int _unique_var = (expr); \
|
||||
if (!_unique_var) \
|
||||
abort(); \
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
/* Does exactly nothing */
|
||||
#define pa_nop() do {} while (false)
|
||||
|
Loading…
Reference in New Issue
Block a user