rtp_player_dialog: Route audio for a stream to left/right speaker in RTP player
[gd/wireshark/.git] / ws_attributes.h
1 /* ws_attributes.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #ifndef __WS_ATTRIBUTES_H__
11 #define __WS_ATTRIBUTES_H__
12
13 #include "ws_compiler_tests.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif /* __cplusplus */
18
19 /*
20  * If we're running GCC or clang define _U_ to be "__attribute__((unused))"
21  * so we can use _U_ to flag unused function parameters and not get warnings
22  * about them. Otherwise, define _U_ to be an empty string so that _U_ used
23  * to flag an unused function parameters will compile with other compilers.
24  *
25  * XXX - similar hints for other compilers?
26  */
27 #if defined(__GNUC__)
28   /* This includes clang */
29   #define _U_ __attribute__((unused))
30 #elif defined(_MSC_VER)
31   #define _U_ __pragma(warning(suppress:4100))
32 #else
33   #define _U_
34 #endif
35
36 /*
37  * WS_NORETURN, before a function declaration, means "this function
38  * never returns".  (It must go before the function declaration, e.g.
39  * "extern WS_NORETURN func(...)" rather than after the function
40  * declaration, as the MSVC version has to go before the declaration.)
41  */
42 #if __has_attribute(noreturn) \
43     || WS_IS_AT_LEAST_GNUC_VERSION(2,5) \
44     || WS_IS_AT_LEAST_SUNC_VERSION(5,9) \
45     || WS_IS_AT_LEAST_XL_C_VERSION(10,1) \
46     || WS_IS_AT_LEAST_HP_C_VERSION(6,10)
47   /*
48    * Compiler with support for __attribute__((noreturn)), or GCC 2.5 and
49    * later, or Solaris Studio 12 (Sun C 5.9) and later, or IBM XL C 10.1
50    * and later (do any earlier versions of XL C support this?), or
51    * HP aCC A.06.10 and later.
52    */
53   #define WS_NORETURN __attribute__((noreturn))
54 #elif defined(_MSC_VER)
55   /*
56    * MSVC.
57    */
58   #define WS_NORETURN __declspec(noreturn)
59 #else
60   #define WS_NORETURN
61 #endif
62
63 /*
64  * WS_RETNONNULL, before a function declaration, means "this function
65  * always returns a non-null pointer".
66  */
67 #if __has_attribute(returns_nonnull) \
68     || WS_IS_AT_LEAST_GNUC_VERSION(4,9)
69   #define WS_RETNONNULL __attribute__((returns_nonnull))
70 #else
71   #define WS_RETNONNULL
72 #endif
73
74 #ifdef __cplusplus
75 }
76 #endif /* __cplusplus */
77
78 #endif /* __WS_ATTRIBUTES_H__ */