photon  1.1
photon_attributes.h
Go to the documentation of this file.
1 // =============================================================================
2 // Photon RDMA Library (libphoton)
3 //
4 // Copyright (c) 2016, Trustees of Indiana University,
5 // All rights reserved.
6 //
7 // This software may be modified and distributed under the terms of the BSD
8 // license. See the COPYING file for details.
9 //
10 // This software was created at the Indiana University Center for Research in
11 // Extreme Scale Technologies (CREST).
12 // =============================================================================
13 
14 #ifndef PHOTON_ATTRIBUTES_H
15 #define PHOTON_ATTRIBUTES_H
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #define PHOTON_ALIGNED(N) __attribute__((aligned(N)))
22 #define PHOTON_INTERNAL __attribute__((visibility("internal")))
23 #define PHOTON_RETURNS_TWICE __attribute__((returns_twice))
24 #define PHOTON_NORETURN __attribute__((noreturn))
25 #define PHOTON_NOINLINE __attribute__((noinline))
26 #define PHOTON_AWAYS_INLINE __attribute__((always_inline))
27 #define PHOTON_OPTIMIZE(S) __attribute__((optimize(S)))
28 #define PHOTON_MALLOC __attribute__((malloc))
29 #define PHOTON_USED __attribute__((used))
30 #define PHOTON_UNUSED __attribute__((unused))
31 #define PHOTON_ASM(S) __asm__(#S)
32 #define PHOTON_PACKED __attribute__((packed))
33 #define PHOTON_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
34 #define PHOTON_WEAK __attribute__((weak))
35 #define PHOTON_CONSTRUCTOR __attribute__((constructor))
36 #define PHOTON_DESTRUCTOR __attribute__((destructor))
37 
38 #ifdef __clang__
39 #define PHOTON_NO_OPTIMIZE __attribute__((optnone))
40 #else
41 #define PHOTON_NO_OPTIMIZE PHOTON_OPTIMIZE("O0")
42 #endif
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif