xref: /freebsd/kerberos5/include/krb5-types.h (revision 3078531de10dcae44b253a35125c949ff4235284)
1 /*
2  * generic krb5-types.h for cross compiling, assume system is posix/sus
3  */
4 
5 /* $FreeBSD$ */
6 
7 #ifndef __krb5_types_h__
8 #define __krb5_types_h__
9 
10 #include <inttypes.h>
11 #include <sys/types.h>
12 #include <sys/socket.h>
13 
14 typedef socklen_t krb5_socklen_t;
15 #include <unistd.h>
16 typedef ssize_t krb5_ssize_t;
17 
18 #if !defined(__has_extension)
19 #define __has_extension(x) 0
20 #endif
21 
22 #define KRB5TYPES_REQUIRE_GNUC(m,n,p) \
23     (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= \
24      (((m) * 10000) + ((n) * 100) + (p)))
25 
26 
27 #ifndef HEIMDAL_DEPRECATED
28 #if __has_extension(deprecated) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
29 #define HEIMDAL_DEPRECATED __attribute__((deprecated))
30 #elif defined(_MSC_VER) && (_MSC_VER>1200)
31 #define HEIMDAL_DEPRECATED __declspec(deprecated)
32 #else
33 #define HEIMDAL_DEPRECATED
34 #endif
35 #endif
36 
37 #ifndef HEIMDAL_PRINTF_ATTRIBUTE
38 #if __has_extension(format) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
39 #define HEIMDAL_PRINTF_ATTRIBUTE(x) __attribute__((format x))
40 #else
41 #define HEIMDAL_PRINTF_ATTRIBUTE(x)
42 #endif
43 #endif
44 
45 #ifndef HEIMDAL_NORETURN_ATTRIBUTE
46 #if __has_extension(noreturn) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
47 #define HEIMDAL_NORETURN_ATTRIBUTE __attribute__((noreturn))
48 #else
49 #define HEIMDAL_NORETURN_ATTRIBUTE
50 #endif
51 #endif
52 
53 #ifndef HEIMDAL_UNUSED_ATTRIBUTE
54 #if __has_extension(unused) || KRB5TYPES_REQUIRE_GNUC(3,1,0)
55 #define HEIMDAL_UNUSED_ATTRIBUTE __attribute__((unused))
56 #else
57 #define HEIMDAL_UNUSED_ATTRIBUTE
58 #endif
59 #endif
60 
61 typedef int krb5_socket_t;
62 
63 #endif /* __krb5_types_h__ */
64