]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix 'cbaud_to_speed' defined but not used on LA32
authormengqinggang <mengqinggang@loongson.cn>
Mon, 23 Mar 2026 07:16:57 +0000 (15:16 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 20 Apr 2026 02:11:37 +0000 (10:11 +0800)
cbaud_to_speed defined without condition, but used
if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_42)

If the condition is not met, a defined but not used
warning will be issued.

Define cbaud_to_speed if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_42)
is true.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/unix/sysv/linux/tst-termios-linux.c

index 6495b435e89da99a425029804d6d12555afdf82b..d9c3284e1cf946d0c71963074dab4323cf72b52c 100644 (file)
@@ -163,18 +163,6 @@ static speed_t speed_to_cbaud (speed_t speed)
   return ct->cbaud;
 }
 
-/* Returns ANY if cbaud is __BOTHER, or BOGUS if invalid */
-static speed_t cbaud_to_speed (speed_t cbaud)
-{
-  const struct cbaud_table *ct;
-  for (ct = cbaud_table; ct->cbaud != BOGUS; ct++)
-    {
-      if (ct->cbaud == cbaud)
-       break;
-    }
-  return ct->speed;
-}
-
 static const char *cbaud_name (speed_t cbaud)
 {
   const struct cbaud_table *ct;
@@ -514,6 +502,18 @@ old_tcspeed_test (int fd, speed_t speed)
   check_speeds_tc (fd, speed, speed);
 }
 
+/* Returns ANY if cbaud is __BOTHER, or BOGUS if invalid */
+static speed_t cbaud_to_speed (speed_t cbaud)
+{
+  const struct cbaud_table *ct;
+  for (ct = cbaud_table; ct->cbaud != BOGUS; ct++)
+    {
+      if (ct->cbaud == cbaud)
+       break;
+    }
+  return ct->speed;
+}
+
 /* Verify that invalid CBAUD values return error for the old interfaces */
 static void
 old_invalid_speeds_test (int fd)