Skip to content

[libcxx] mark _LIBCPP_VERBOSE_{ABORT,TRAP} nomerge#200078

Draft
gburgessiv wants to merge 3 commits into
llvm:mainfrom
gburgessiv:nomerge-verbose-trap
Draft

[libcxx] mark _LIBCPP_VERBOSE_{ABORT,TRAP} nomerge#200078
gburgessiv wants to merge 3 commits into
llvm:mainfrom
gburgessiv:nomerge-verbose-trap

Conversation

@gburgessiv
Copy link
Copy Markdown
Member

Suggested in #198831 - this may increase binary size slightly (since TRAPs can no longer fold together), but makes attribution significantly easier.

Suggested in llvm#198831 - this may increase binary size slightly (since
`TRAP`s can no longer fold together), but makes attribution
significantly easier.
@gburgessiv
Copy link
Copy Markdown
Member Author

Will mark ready once CI's happy

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

✅ With the latest revision this PR passed the C/C++ code formatter.

# define _LIBCPP_VERBOSE_ABORT(...) \
({ \
decltype(::std::__use(__VA_ARGS__))(); \
[[clang::__nomerge__]] __builtin_abort(); \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TIL that we support __ prefixed+suffixed identifiers for attributes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please don't modify the C++03 headers.

Comment on lines +24 to +25
[[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _NOEXCEPT;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unrelated change?

void __use(const char*, ...);
# define _LIBCPP_VERBOSE_ABORT(...) (decltype(::std::__use(__VA_ARGS__))(), __builtin_abort())
# define _LIBCPP_VERBOSE_ABORT(...) \
({ \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm really not a huge fan of using statement expressions. Unfortunately I didn't manage to come up with anything similar which worked and was still a single expression.

# define _LIBCPP_VERBOSE_ABORT(...) \
({ \
decltype(::std::__use(__VA_ARGS__))(); \
[[clang::__nomerge__]] __builtin_abort(); \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
[[clang::__nomerge__]] __builtin_abort(); \
[[_Clang::__nomerge__]] __builtin_abort(); \

})
# else
# define _LIBCPP_VERBOSE_ABORT(...) ::std::__libcpp_verbose_abort(__VA_ARGS__)
# define _LIBCPP_VERBOSE_ABORT(...) ({ [[clang::__nomerge__]] ::std::__libcpp_verbose_abort(__VA_ARGS__); })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm much less certain about this one, since we don't really use that much debuggability while potentially generating significantly more code.

// The decltype is there to suppress -Wunused warnings in this configuration.
void __use(const char*, ...);
# define _LIBCPP_VERBOSE_ABORT(...) (decltype(::std::__use(__VA_ARGS__))(), __builtin_abort())
# define _LIBCPP_VERBOSE_ABORT(...) \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, I'm not sure we want to change this. It's really just a fallback for old platforms.

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.

3 participants