Fix std::tmpnam deprecation in event_log_visualizer

This CL replaces the deprecated std::tmpnam() function with
webrtc::test::TempFilename() to avoid compiler warnings on macOS.

This change requires:
1. Marking rtc_executable("event_log_visualizer") as testonly = true.
2. Adding dependencies on //test:test_support and //test:fileutils.
3. Removing the -Wno-deprecated-declarations suppression flag.

Bug: webrtc:14248
Change-Id: I8989a1839fabf70549843fd37d1c35df6c470efd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/448160
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46883}
diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn
index c14c29d..1515936 100644
--- a/rtc_tools/BUILD.gn
+++ b/rtc_tools/BUILD.gn
@@ -390,9 +390,9 @@
       deps = [
         ":chart_proto",
         ":event_log_visualizer_bindings",
+        "../test:fileutils",
         "//rtc_base:protobuf_utils",
         "//rtc_base/system:file_wrapper",
-        "//test:fileutils",
         "//test:test_support",
         "//third_party/abseil-cpp/absl/strings:string_view",
       ]
@@ -444,9 +444,8 @@
   if (!build_with_chromium) {
     if (rtc_enable_protobuf) {
       rtc_executable("event_log_visualizer") {
-        # TODO(bugs.webrtc.org/14248): Remove once usage of std::tmpnam
-        # is removed (in favor of in memory InputAudioFile.
-        cflags_cc = [ "-Wno-deprecated-declarations" ]
+        testonly = true
+
         sources = [
           "rtc_event_log_visualizer/conversational_speech_en.h",
           "rtc_event_log_visualizer/main.cc",
@@ -466,6 +465,7 @@
           "../rtc_base:checks",
           "../rtc_base:logging",
           "../rtc_base:protobuf_utils",
+          "../test:fileutils",
           "//third_party/abseil-cpp/absl/algorithm:container",
           "//third_party/abseil-cpp/absl/flags:config",
           "//third_party/abseil-cpp/absl/flags:flag",
diff --git a/rtc_tools/rtc_event_log_visualizer/main.cc b/rtc_tools/rtc_event_log_visualizer/main.cc
index 03512b1..6105e01 100644
--- a/rtc_tools/rtc_event_log_visualizer/main.cc
+++ b/rtc_tools/rtc_event_log_visualizer/main.cc
@@ -41,6 +41,7 @@
 #include "rtc_tools/rtc_event_log_visualizer/conversational_speech_en.h"
 #include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
 #include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
+#include "test/testsupport/file_utils.h"
 
 ABSL_FLAG(std::string,
           plot,
@@ -215,10 +216,11 @@
   if (!absl::GetFlag(FLAGS_wav_filename).empty()) {
     wav_path = absl::GetFlag(FLAGS_wav_filename);
   } else {
-    // TODO(bugs.webrtc.org/14248): Remove the need to generate a file
-    // and read the file directly from memory.
-    wav_path = std::tmpnam(nullptr);
-    std::ofstream out_wav_file(wav_path);
+    // TODO(bugs.webrtc.org/14248): Remove the need to generate a file.
+    wav_path = webrtc::test::TempFilename(webrtc::test::OutputPath(),
+                                          "temp_speech.wav");
+
+    std::ofstream out_wav_file(wav_path, std::ios::binary);
     out_wav_file.write(
         reinterpret_cast<char*>(&webrtc::conversational_speech_en_wav[0]),
         webrtc::conversational_speech_en_wav_len);