Skip to content

Commit

Permalink
Merge pull request FRRouting#14414 from opensourcerouting/coverity-as…
Browse files Browse the repository at this point in the history
…sume

lib: another attempt at Coverity false positives
  • Loading branch information
riw777 authored Sep 19, 2023
2 parents ffbff9b + 71510e5 commit 7e1eb2a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ extern "C" {
#define assume(x)
#endif

#ifdef __COVERITY__
/* __coverity_panic__() is named a bit poorly, it's essentially the same as
* __builtin_unreachable(). Used to eliminate false positives.
*/
#undef assume
#define assume(x) do { if (!(x)) __coverity_panic__(); } while (0)
#endif

/* for helper functions defined inside macros */
#define macro_inline static inline __attribute__((unused))
#define macro_pure static inline __attribute__((unused, pure))
Expand Down

0 comments on commit 7e1eb2a

Please sign in to comment.