2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2018 Solarflare Communications Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * The views and conclusions contained in the software and documentation are
29 * those of the authors and should not be interpreted as representing official
30 * policies, either expressed or implied, of the FreeBSD Project.
35 #ifndef _SYS_EFX_ANNOTE_H
36 #define _SYS_EFX_ANNOTE_H
38 #if defined(_WIN32) || defined(_WIN64)
39 #define EFX_HAVE_WINDOWS_ANNOTATIONS 1
41 #define EFX_HAVE_WINDOWS_ANNOTATIONS 0
42 #endif /* defined(_WIN32) || defined(_WIN64) */
45 #define EFX_HAVE_SOLARIS_ANNOTATIONS 1
47 #define EFX_HAVE_SOLARIS_ANNOTATIONS 0
48 #endif /* defined(__sun) */
50 #if !EFX_HAVE_WINDOWS_ANNOTATIONS
52 /* Ignore Windows SAL annotations on other platforms */
55 #define __in_ecount(_n)
56 #define __in_ecount_opt(_n)
57 #define __in_bcount(_n)
58 #define __in_bcount_opt(_n)
62 #define __out_ecount(_n)
63 #define __out_ecount_opt(_n)
64 #define __out_ecount_part(_n, _l)
65 #define __out_bcount(_n)
66 #define __out_bcount_opt(_n)
67 #define __out_bcount_part(_n, _l)
68 #define __out_bcount_part_opt(_n, _l)
75 #define __inout_ecount(_n)
76 #define __inout_ecount_opt(_n)
77 #define __inout_bcount(_n)
78 #define __inout_bcount_opt(_n)
79 #define __inout_bcount_full_opt(_n)
81 #define __deref_out_bcount_opt(n)
86 #define __drv_when(_p, _c)
88 #endif /* !EFX_HAVE_WINDOWS_ANNOTATIONS */
90 #if !EFX_HAVE_SOLARIS_ANNOTATIONS
92 #if EFX_HAVE_WINDOWS_ANNOTATIONS
95 * Support some SunOS/Solaris style _NOTE() annotations
97 * At present with the facilities provided in the WDL and the SAL we can only
98 * easily act upon _NOTE(ARGUNUSED(arglist)) annotations.
100 * Intermediate macros to expand individual _NOTE annotation types into
101 * something the WDK or SAL can understand. They shouldn't be used directly,
102 * for example EFX_NOTE_ARGUNUSED() is only used as an intermediate step on the
103 * transformation of _NOTE(ARGUNSED(arg1, arg2)) into
104 * UNREFERENCED_PARAMETER((arg1, arg2));
106 #define EFX_NOTE_ALIGNMENT(_fname, _n)
107 #define EFX_NOTE_ARGUNUSED(...) UNREFERENCED_PARAMETER((__VA_ARGS__));
108 #define EFX_NOTE_CONSTANTCONDITION
109 #define EFX_NOTE_CONSTCOND
110 #define EFX_NOTE_EMPTY
111 #define EFX_NOTE_FALLTHROUGH
112 #define EFX_NOTE_FALLTHRU
113 #define EFX_NOTE_LINTED(_msg)
114 #define EFX_NOTE_NOTREACHED
115 #define EFX_NOTE_PRINTFLIKE(_n)
116 #define EFX_NOTE_SCANFLIKE(_n)
117 #define EFX_NOTE_VARARGS(_n)
119 #define _NOTE(_annotation) EFX_NOTE_ ## _annotation
123 /* Ignore Solaris annotations on other platforms */
125 #define _NOTE(_annotation)
127 #endif /* EFX_HAVE_WINDOWS_ANNOTATIONS */
129 #endif /* !EFX_HAVE_SOLARIS_ANNOTATIONS */
131 #endif /* _SYS_EFX_ANNOTE_H */