From eeea445e1d0f0aac813d4eccd7b8f55477772dd0 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 4 Jul 2025 17:03:27 +0100 Subject: [PATCH] libstdc++: Avoid -Wswitch warning from chrono formatters Add a default case to the switch to suppress warnings about unhandled enumeration values. This is a consteval function, so if the default case is ever reached it will be an error not silent miscompilation. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_duration::_S_spec_for): Add default case to switch and use __builtin_unreachable. --- libstdc++-v3/include/bits/chrono_io.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index bcf9830fb9e..72cd569ccd6 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -1841,6 +1841,8 @@ namespace __format break; case _None: break; + default: + __builtin_unreachable(); } return __res; }; -- 2.47.3