Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion flang/runtime/io-api-minimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ bool IODEF(OutputLogical)(Cookie cookie, bool truth) {
// Provide own definition for `std::__libcpp_verbose_abort` to avoid dependency
// on the version provided by libc++.

void std::__libcpp_verbose_abort(char const *format, ...) {
#if !defined(_LIBCPP_VERBOSE_ABORT_NOEXCEPT)
#define _LIBCPP_VERBOSE_ABORT_NOEXCEPT
#endif

void std::__libcpp_verbose_abort(
char const *format, ...) _LIBCPP_VERBOSE_ABORT_NOEXCEPT {
Copy link
Member

Choose a reason for hiding this comment

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

The right way of fixing this would be:

void std::__libcpp_verbose_abort(char const *format, ...)
    noexcept(noexcept(std::__libcpp_verbose_abort("")))
{
  // ...
}

This allows unconditionally using the right noexcept-ness based on how the base function has been declared.

About the more general question of whether libc++ supports being used header-only (without linking against the dylib), the answer is no, but some stuff will still happen to work if you do that. That's a brittle setup though, for example I expect that you would encounter a linker error if you tried using std::shared_ptr or std::sort(int*, int*) anywhere since those are in the dylib. Is there a reason why you don't link against the libc++ built library?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why you don't link against the libc++ built library?

That is a very good question that I was pondering myself repeatedly.
I hope it is ok to ask @sscalpone for clarification.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ldionne I've implemented your suggested fix.

va_list list;
va_start(list, format);
std::vfprintf(stderr, format, list);
Expand Down
Loading