Changeset - r28479:b660b702c15c
[Not reviewed]
master
0 1 0
Patric Stout - 11 months ago 2024-01-16 20:58:55
truebrain@openttd.org
Codechange: compile-time validate the string format of SlErrorCorruptFmt (#11805)
1 file changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/saveload/saveload_error.hpp
Show inline comments
 
@@ -20,15 +20,14 @@ void NORETURN SlErrorCorrupt(const std::
 
 * Issue an SlErrorCorrupt with a format string.
 
 * @param format_string The formatting string to tell what to do with the remaining arguments.
 
 * @param fmt_args The arguments to be passed to fmt.
 
 * @tparam T The type of formatting parameter.
 
 * @tparam Args The types of the fmt arguments.
 
 * @note This function does never return as it throws an exception to
 
 *       break out of all the saveload code.
 
 */
 
template <typename T, typename ... Args>
 
inline void NORETURN SlErrorCorruptFmt(const T &format, Args&&... fmt_args)
 
template <typename ... Args>
 
inline void NORETURN SlErrorCorruptFmt(const fmt::format_string<Args...> format, Args&&... fmt_args)
 
{
 
	SlErrorCorrupt(fmt::format(format, fmt_args...));
 
	SlErrorCorrupt(fmt::format(format, std::forward<Args>(fmt_args)...));
 
}
 

	
 
#endif /* SAVELOAD_ERROR_HPP */
0 comments (0 inline, 0 general)