Fredrik Solenberg | 500e75b | 2018-05-23 11:49:01 +0200 | [diff] [blame] | 1 | /* |
| 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 Solenberg | 500e75b | 2018-05-23 11:49:01 +0200 | [diff] [blame] | 14 | // Prevent the compiler from warning about an unused variable. For example: |
| 15 | // int result = DoSomething(); |
Mirko Bonadei | 25ab322 | 2021-07-08 20:08:20 +0200 | [diff] [blame] | 16 | // RTC_DCHECK(result == 17); |
Fredrik Solenberg | 500e75b | 2018-05-23 11:49:01 +0200 | [diff] [blame] | 17 | // 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 Lee | 83ceb90 | 2021-11-16 11:31:57 +0900 | [diff] [blame] | 21 | #ifdef __cplusplus |
Fredrik Solenberg | 500e75b | 2018-05-23 11:49:01 +0200 | [diff] [blame] | 22 | #define RTC_UNUSED(x) static_cast<void>(x) |
Byoungchan Lee | 83ceb90 | 2021-11-16 11:31:57 +0900 | [diff] [blame] | 23 | #else |
| 24 | #define RTC_UNUSED(x) (void)(x) |
| 25 | #endif |
Fredrik Solenberg | 500e75b | 2018-05-23 11:49:01 +0200 | [diff] [blame] | 26 | #endif // RTC_UNUSED |
| 27 | |
| 28 | #endif // RTC_BASE_SYSTEM_UNUSED_H_ |