Skip to content
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

Fix: enable FMT_NORETURN without exception support too #3917

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 4 additions & 3 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@
#endif

// Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings.
#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && FMT_EXCEPTIONS && !FMT_MSC_VERSION && \
!defined(__NVCC__)
#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && !defined(__NVCC__)
# define FMT_NORETURN [[noreturn]]
#else
# define FMT_NORETURN
Expand Down Expand Up @@ -2754,7 +2753,9 @@ template <typename Char, typename... Args> class format_string_checker {
return id >= 0 && id < num_args ? parse_funcs_[id](context_) : begin;
}

FMT_CONSTEXPR void on_error(const char* message) { report_error(message); }
FMT_NORETURN FMT_CONSTEXPR void on_error(const char* message) {
report_error(message);
}
};

// A base class for compile-time strings.
Expand Down
2 changes: 1 addition & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -4302,7 +4302,7 @@ void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
return begin;
}

void on_error(const char* message) { report_error(message); }
FMT_NORETURN void on_error(const char* message) { report_error(message); }
};
detail::parse_format_string<false>(fmt, format_handler(out, fmt, args, loc));
}
Expand Down
Loading