From: Adhemerval Zanella Date: Mon, 20 Oct 2025 12:27:49 +0000 (-0300) Subject: termios: Suppress clang -Winitializer-overrider on ___cbaud_to_speed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=062510a0c1623b90a8b12e1f25661b460679e0f9;p=thirdparty%2Fglibc.git termios: Suppress clang -Winitializer-overrider on ___cbaud_to_speed clang-18 and onwards issues: ../sysdeps/unix/sysv/linux/speed.c:71:23: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides] 71 | [_cbix(__B0)] = 0, | ^ ../sysdeps/unix/sysv/linux/speed.c:70:34: note: previous initialization is here 70 | [0 ... _cbix(CBAUDMASK)] = -1, [...] The override is explicit used to support the same initialization on multiple platforms (since the baud values differ on alpha and powerpc). Reviewed-by: Collin Funk --- diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c index 4efb0ded59..3882d4ed32 100644 --- a/sysdeps/unix/sysv/linux/speed.c +++ b/sysdeps/unix/sysv/linux/speed.c @@ -17,6 +17,7 @@ . */ #include +#include /* Conversions between legacy c_cflag fields and actual baud rates */ @@ -60,6 +61,10 @@ speed_t ___cbaud_to_speed (tcflag_t c_cflag, speed_t other) { + /* The override is explicit used to support the same initialization on + multiple platforms. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (18, "-Winitializer-overrides"); static const speed_t cbaudix_to_speed [] = { [0 ... _cbix(CBAUDMASK)] = -1, @@ -124,6 +129,7 @@ ___cbaud_to_speed (tcflag_t c_cflag, speed_t other) [_cbix(__B4000000)] = 4000000, #endif }; + DIAG_POP_NEEDS_COMMENT_CLANG; speed_t speed; if (c_cflag & (tcflag_t)(~CBAUDMASK))