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 <collin.funk1@gmail.com>
This commit is contained in:
Adhemerval Zanella 2025-10-20 09:27:49 -03:00
parent 228ae5a354
commit 062510a0c1
1 changed files with 6 additions and 0 deletions

View File

@ -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))