blob: 03d0c2f0a795c98574308b6a7dd4aef2ff058ea6 [file] [log] [blame]
Fredrik Solenberg500e75b2018-05-23 11:49:01 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef RTC_BASE_SYSTEM_UNUSED_H_
12#define RTC_BASE_SYSTEM_UNUSED_H_
13
Fredrik Solenberg500e75b2018-05-23 11:49:01 +020014// Prevent the compiler from warning about an unused variable. For example:
15// int result = DoSomething();
Mirko Bonadei25ab3222021-07-08 20:08:20 +020016// RTC_DCHECK(result == 17);
Fredrik Solenberg500e75b2018-05-23 11:49:01 +020017// RTC_UNUSED(result);
18// Note: In most cases it is better to remove the unused variable rather than
19// suppressing the compiler warning.
20#ifndef RTC_UNUSED
Byoungchan Lee83ceb902021-11-16 11:31:57 +090021#ifdef __cplusplus
Fredrik Solenberg500e75b2018-05-23 11:49:01 +020022#define RTC_UNUSED(x) static_cast<void>(x)
Byoungchan Lee83ceb902021-11-16 11:31:57 +090023#else
24#define RTC_UNUSED(x) (void)(x)
25#endif
Fredrik Solenberg500e75b2018-05-23 11:49:01 +020026#endif // RTC_UNUSED
27
28#endif // RTC_BASE_SYSTEM_UNUSED_H_