Skip to content

feat: mark _mi_assert_fail as noreturn, cold and throw #1091

Closed
@picnixz

Description

@picnixz

Note

This is a backport from python/cpython#134586, which I'll simply copy-paste:

Because _mi_assert_fail is not marked as a noreturn function, the assertion is not understood by CLion and I have some false positives telling me "this ptr is not NULL" while just above there is mi_assert(ptr != NULL);. To improve IDE's analysis, I suggest to mark _mi_assert_fail with __attribute__((__noreturn__)) and __THROW for GCC, the same attributes that are put on __assert_fail:

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

For newer GCC versions, it was additionally marked as cold (see python/cpython#134586 (comment)).

cc @colesbury

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions