1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2019-2021 Xilinx, Inc.
4 * Copyright(c) 2018-2019 Solarflare Communications Inc.
7 #ifndef _SYS_EFX_ANNOTE_H
8 #define _SYS_EFX_ANNOTE_H
10 #if defined(_WIN32) || defined(_WIN64)
11 #define EFX_HAVE_WINDOWS_ANNOTATIONS 1
13 #define EFX_HAVE_WINDOWS_ANNOTATIONS 0
14 #endif /* defined(_WIN32) || defined(_WIN64) */
17 #define EFX_HAVE_SOLARIS_ANNOTATIONS 1
19 #define EFX_HAVE_SOLARIS_ANNOTATIONS 0
20 #endif /* defined(__sun) */
22 #if !EFX_HAVE_WINDOWS_ANNOTATIONS
24 /* Ignore Windows SAL annotations on other platforms */
27 #define __in_ecount(_n)
28 #define __in_ecount_opt(_n)
29 #define __in_bcount(_n)
30 #define __in_bcount_opt(_n)
34 #define __out_ecount(_n)
35 #define __out_ecount_opt(_n)
36 #define __out_ecount_part(_n, _l)
37 #define __out_bcount(_n)
38 #define __out_bcount_opt(_n)
39 #define __out_bcount_part(_n, _l)
40 #define __out_bcount_part_opt(_n, _l)
47 #define __inout_ecount(_n)
48 #define __inout_ecount_opt(_n)
49 #define __inout_bcount(_n)
50 #define __inout_bcount_opt(_n)
51 #define __inout_bcount_full_opt(_n)
53 #define __deref_out_bcount_opt(n)
58 #define __drv_when(_p, _c)
60 #endif /* !EFX_HAVE_WINDOWS_ANNOTATIONS */
62 #if !EFX_HAVE_SOLARIS_ANNOTATIONS
64 #if EFX_HAVE_WINDOWS_ANNOTATIONS
67 * Support some SunOS/Solaris style _NOTE() annotations
69 * At present with the facilities provided in the WDL and the SAL we can only
70 * easily act upon _NOTE(ARGUNUSED(arglist)) annotations.
72 * Intermediate macros to expand individual _NOTE annotation types into
73 * something the WDK or SAL can understand. They shouldn't be used directly,
74 * for example EFX_NOTE_ARGUNUSED() is only used as an intermediate step on the
75 * transformation of _NOTE(ARGUNSED(arg1, arg2)) into
76 * UNREFERENCED_PARAMETER((arg1, arg2));
78 #define EFX_NOTE_ALIGNMENT(_fname, _n)
79 #define EFX_NOTE_ARGUNUSED(...) UNREFERENCED_PARAMETER((__VA_ARGS__));
80 #define EFX_NOTE_CONSTANTCONDITION
81 #define EFX_NOTE_CONSTCOND
82 #define EFX_NOTE_EMPTY
83 #define EFX_NOTE_FALLTHROUGH
84 #define EFX_NOTE_FALLTHRU
85 #define EFX_NOTE_LINTED(_msg)
86 #define EFX_NOTE_NOTREACHED
87 #define EFX_NOTE_PRINTFLIKE(_n)
88 #define EFX_NOTE_SCANFLIKE(_n)
89 #define EFX_NOTE_VARARGS(_n)
91 #define _NOTE(_annotation) EFX_NOTE_ ## _annotation
95 /* Ignore Solaris annotations on other platforms */
97 #define _NOTE(_annotation)
99 #endif /* EFX_HAVE_WINDOWS_ANNOTATIONS */
101 #endif /* !EFX_HAVE_SOLARIS_ANNOTATIONS */
103 #endif /* _SYS_EFX_ANNOTE_H */