xref: /aosp_15_r20/external/webrtc/rtc_base/system/unused.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 
14 // Prevent the compiler from warning about an unused variable. For example:
15 //   int result = DoSomething();
16 //   RTC_DCHECK(result == 17);
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
21 #ifdef __cplusplus
22 #define RTC_UNUSED(x) static_cast<void>(x)
23 #else
24 #define RTC_UNUSED(x) (void)(x)
25 #endif
26 #endif  // RTC_UNUSED
27 
28 #endif  // RTC_BASE_SYSTEM_UNUSED_H_
29