Skip to content

Conversation

@elupus
Copy link
Contributor

@elupus elupus commented Apr 8, 2025

Can't find a background to why this inline wrapper existed around the assert call.

Can't find a background to why this inline wrapper existed
around the assert call.
@elupus elupus requested a review from hefloryd April 8, 2025 12:55
#define CLANG_ANALYZER_NORETURN
#endif

static inline void cc_assert (int exp) CLANG_ANALYZER_NORETURN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, the wrapper exists to be able to add the LCOV_EXCL_LINE exclusion marker. Without you must also trigger the assertion for full coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like a CLANG error?

The function used on linux is this:

extern void __assert_fail (const char *__assertion, const char *__file,
			   unsigned int __line, const char *__function)
     __THROW __attribute__ ((__noreturn__));

It's decorated by noreturn already which should be a harder form.

The Clang-specific ‘analyzer_noreturn’ attribute is almost identical to ‘noreturn’ except that it is ignored by the compiler for the purposes of code generation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah vänta du menade LCOV_EXCL_LINE. Sorry. Ja den är ju något annat.

@elupus
Copy link
Contributor Author

elupus commented Apr 10, 2025

Will close for now. Will need to figure out how to enable all the time.

@elupus elupus closed this Apr 10, 2025
@elupus elupus deleted the assert_lines branch April 10, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants