Skip to content

fix: ensure CC_ASSERT retain line info #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

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
@@ -34,11 +34,6 @@ extern "C" {
#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