Fix -Wunused-but-set-variable

Bug: chromium:1203071
Change-Id: I338bd31ab0e74751f2c0abd5d441ea03ac33dead
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237880
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35350}
This commit is contained in:
Byoungchan Lee
2021-11-16 11:31:57 +09:00
committed by WebRTC LUCI CQ
parent f0f474373c
commit 83ceb90fdf
4 changed files with 9 additions and 0 deletions

View File

@ -18,7 +18,11 @@
// Note: In most cases it is better to remove the unused variable rather than // Note: In most cases it is better to remove the unused variable rather than
// suppressing the compiler warning. // suppressing the compiler warning.
#ifndef RTC_UNUSED #ifndef RTC_UNUSED
#ifdef __cplusplus
#define RTC_UNUSED(x) static_cast<void>(x) #define RTC_UNUSED(x) static_cast<void>(x)
#else
#define RTC_UNUSED(x) (void)(x)
#endif
#endif // RTC_UNUSED #endif // RTC_UNUSED
#endif // RTC_BASE_SYSTEM_UNUSED_H_ #endif // RTC_BASE_SYSTEM_UNUSED_H_

View File

@ -1083,6 +1083,7 @@ if (is_ios || is_mac) {
"../media:rtc_media_tests_utils", "../media:rtc_media_tests_utils",
"../rtc_base", "../rtc_base",
"../rtc_base:gunit_helpers", "../rtc_base:gunit_helpers",
"../rtc_base/system:unused",
"../system_wrappers", "../system_wrappers",
"//third_party/libyuv", "//third_party/libyuv",
] ]

View File

@ -21,6 +21,7 @@
#import "api/peerconnection/RTCRtpTransceiver.h" #import "api/peerconnection/RTCRtpTransceiver.h"
#import "api/peerconnection/RTCSessionDescription.h" #import "api/peerconnection/RTCSessionDescription.h"
#import "api/peerconnection/RTCVideoSource.h" #import "api/peerconnection/RTCVideoSource.h"
#import "rtc_base/system/unused.h"
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
@ -64,6 +65,7 @@
factory = nil; factory = nil;
} }
mediaStream = nil; mediaStream = nil;
RTC_UNUSED(mediaStream);
} }
XCTAssertTrue(true, "Expect test does not crash"); XCTAssertTrue(true, "Expect test does not crash");

View File

@ -352,6 +352,7 @@ static const uint8_t SPS_PPS_BUFFER[] = {
cmsampleSize, cmsampleSize,
kCMBlockBufferAssureMemoryNowFlag, kCMBlockBufferAssureMemoryNowFlag,
&block_buffer); &block_buffer);
XCTAssertEqual(kCMBlockBufferNoErr, status);
status = CMSampleBufferCreate(nullptr, status = CMSampleBufferCreate(nullptr,
block_buffer, block_buffer,
@ -365,6 +366,7 @@ static const uint8_t SPS_PPS_BUFFER[] = {
0, 0,
nullptr, nullptr,
&sample_buffer); &sample_buffer);
XCTAssertEqual(noErr, status);
return sample_buffer; return sample_buffer;
} }