[tint] Narrow UBU supression in terminal_posix.cc

The actual warnings are coming from library macros that are used, so
are unavoidable. I have restricted of the scope of the supression to
the problematic code.

Bug: 394825124
Change-Id: I24635b69e0654e05311b95f80ac10a11d81b5498
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/235574
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/utils/system/terminal_posix.cc b/src/tint/utils/system/terminal_posix.cc
index df61519..1c07c8e 100644
--- a/src/tint/utils/system/terminal_posix.cc
+++ b/src/tint/utils/system/terminal_posix.cc
@@ -45,8 +45,6 @@
 #include "src/tint/utils/system/env.h"
 #include "src/tint/utils/system/terminal.h"
 
-TINT_BEGIN_DISABLE_WARNING(UNSAFE_BUFFER_USAGE);
-
 namespace tint {
 namespace {
 
@@ -90,8 +88,10 @@
     // Returns true if there's data available on stdin, or false if no data was available after
     // 100ms.
     auto poll_stdin = [] {
-        // Note: These macros introduce identifiers that start with `__`.
+        // These macros introduce identifiers that start with `__` and use c-style memory access,
+        // thus cause warnings.
         TINT_BEGIN_DISABLE_WARNING(RESERVED_IDENTIFIER);
+        TINT_BEGIN_DISABLE_WARNING(UNSAFE_BUFFER_USAGE);
         fd_set rfds{};
         FD_ZERO(&rfds);
         FD_SET(STDIN_FILENO, &rfds);
@@ -101,6 +101,7 @@
         tv.tv_usec = 100'000;
         int res = select(STDIN_FILENO + 1, &rfds, nullptr, nullptr, &tv);
         return res > 0 && FD_ISSET(STDIN_FILENO, &rfds);
+        TINT_END_DISABLE_WARNING(UNSAFE_BUFFER_USAGE);
         TINT_END_DISABLE_WARNING(RESERVED_IDENTIFIER);
     };
 
@@ -230,5 +231,3 @@
 }
 
 }  // namespace tint
-
-TINT_END_DISABLE_WARNING(UNSAFE_BUFFER_USAGE);