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