mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Implement G_ANALYZER_NORETURN for Coverity
This change is proposed by Kamil Dudka. It teaches Coverity to assume that g_critical() will never return, which is desirable for the same reasons it is for scan-build: once you've triggered undefined behavior, the game is already lost, and there's limited benefit from trying to avoid every possible memory leak on such codepaths. Notably, this affects g_return_if_fail(). Arguably it might be desirable to fix every such issue, but if we're already not doing so for scan-build, it doesn't make sense to hold developers working with Coverity to a higher standard. This allows focusing on more serious issues found by Coverity. Thanks Kamil!
This commit is contained in:
parent
80c2981b62
commit
f97ff20adf
@ -760,6 +760,9 @@
|
|||||||
#if g_macro__has_feature(attribute_analyzer_noreturn) && defined(__clang_analyzer__)
|
#if g_macro__has_feature(attribute_analyzer_noreturn) && defined(__clang_analyzer__)
|
||||||
#define G_ANALYZER_ANALYZING 1
|
#define G_ANALYZER_ANALYZING 1
|
||||||
#define G_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
#define G_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
||||||
|
#elif defined(__COVERITY__)
|
||||||
|
#define G_ANALYZER_ANALYZING 1
|
||||||
|
#define G_ANALYZER_NORETURN __attribute__((noreturn))
|
||||||
#else
|
#else
|
||||||
#define G_ANALYZER_ANALYZING 0
|
#define G_ANALYZER_ANALYZING 0
|
||||||
#define G_ANALYZER_NORETURN
|
#define G_ANALYZER_NORETURN
|
||||||
|
Loading…
Reference in New Issue
Block a user