dsdb: reset schema->{classes,attributes}_to_remove_size to 0
[Samba/gebeck_regimport.git] / lib / util / attr.h
blobb72696a8dc3c8ca515d273b3cc8683c617fa409d
1 /*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __UTIL_ATTR_H__
21 #define __UTIL_ATTR_H__
23 #ifndef _UNUSED_
24 #ifdef __GNUC__
25 /** gcc attribute used on function parameters so that it does not emit
26 * warnings about them being unused. **/
27 # define _UNUSED_ __attribute__ ((unused))
28 #else
29 # define _UNUSED_
30 /** Feel free to add definitions for other compilers here. */
31 #endif
32 #endif
33 #ifndef UNUSED
34 #define UNUSED(param) param _UNUSED_
35 #endif
37 #ifndef _DEPRECATED_
38 #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
39 #define _DEPRECATED_ __attribute__ ((deprecated))
40 #else
41 #define _DEPRECATED_
42 #endif
43 #endif
45 #ifndef _WARN_UNUSED_RESULT_
46 #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
47 #define _WARN_UNUSED_RESULT_ __attribute__ ((warn_unused_result))
48 #else
49 #define _WARN_UNUSED_RESULT_
50 #endif
51 #endif
53 #ifndef _NORETURN_
54 #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
55 #define _NORETURN_ __attribute__ ((noreturn))
56 #else
57 #define _NORETURN_
58 #endif
59 #endif
61 #ifndef _PURE_
62 #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1)
63 #define _PURE_ __attribute__((pure))
64 #else
65 #define _PURE_
66 #endif
67 #endif
69 #ifndef NONNULL
70 #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1)
71 #define NONNULL(param) param __attribute__((nonnull))
72 #else
73 #define NONNULL(param) param
74 #endif
75 #endif
77 #ifndef PRINTF_ATTRIBUTE
78 #if __GNUC__ >= 3
79 /** Use gcc attribute to check printf fns. a1 is the 1-based index of
80 * the parameter containing the format, and a2 the index of the first
81 * argument. Note that some gcc 2.x versions don't handle this
82 * properly **/
83 #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
84 #else
85 #define PRINTF_ATTRIBUTE(a1, a2)
86 #endif
87 #endif
89 #ifndef FORMAT_ATTRIBUTE
90 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
91 /** Use gcc attribute to check printf fns. a1 is argument to format()
92 * in the above macro. This is needed to support Heimdal's printf
93 * decorations. Note that some gcc 2.x versions don't handle this
94 * properly, and as such I've used the same minimum from heimdal: GCC 3.1 **/
95 #define FORMAT_ATTRIBUTE(a) __attribute__ ((format a))
96 #else
97 #define FORMAT_ATTRIBUTE(a)
98 #endif
99 #endif
101 #endif /* __UTIL_ATTR_H__ */