[PATCH 52/59] termios: Suppress clang -Winitializer-overrider on ___cbaud_to_speed
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Oct 20 12:27:49 GMT 2025
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).
---
sysdeps/unix/sysv/linux/speed.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c
index 4efb0ded59b..3882d4ed329 100644
--- a/sysdeps/unix/sysv/linux/speed.c
+++ b/sysdeps/unix/sysv/linux/speed.c
@@ -17,6 +17,7 @@
<https://www.gnu.org/licenses/>. */
#include <termios_internals.h>
+#include <libc-diag.h>
/* 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))
--
2.43.0
More information about the Libc-alpha
mailing list