X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FSupport%2FCompiler.h;h=99a02f7ada03b6542d7c6333d10bc385b2510ad4;hp=bd197e2308cb251d994e466bae4103d8c17109b7;hb=83b18356e682224e5b6fc8fd84272897bf57201d;hpb=9f952dd0f6f0c0cda8ee9a15701ce28e6dd5a3bc diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index bd197e2308c..99a02f7ada0 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -189,7 +189,7 @@ /// 3.4 supported this but is buggy in various cases and produces unimplemented /// errors, just use it in GCC 4.0 and later. #if __has_attribute(always_inline) || LLVM_GNUC_PREREQ(4, 0, 0) -#define LLVM_ATTRIBUTE_ALWAYS_INLINE inline __attribute__((always_inline)) +#define LLVM_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) #elif defined(_MSC_VER) #define LLVM_ATTRIBUTE_ALWAYS_INLINE __forceinline #else @@ -293,6 +293,34 @@ # define LLVM_ALIGNAS(x) alignas(x) #endif +/// \macro LLVM_PACKED +/// \brief Used to specify a packed structure. +/// LLVM_PACKED( +/// struct A { +/// int i; +/// int j; +/// int k; +/// long long l; +/// }); +/// +/// LLVM_PACKED_START +/// struct B { +/// int i; +/// int j; +/// int k; +/// long long l; +/// }; +/// LLVM_PACKED_END +#ifdef _MSC_VER +# define LLVM_PACKED(d) __pragma(pack(push, 1)) d __pragma(pack(pop)) +# define LLVM_PACKED_START __pragma(pack(push, 1)) +# define LLVM_PACKED_END __pragma(pack(pop)) +#else +# define LLVM_PACKED(d) d __attribute__((packed)) +# define LLVM_PACKED_START _Pragma("pack(push, 1)") +# define LLVM_PACKED_END _Pragma("pack(pop)") +#endif + /// \macro LLVM_PTR_SIZE /// \brief A constant integer equivalent to the value of sizeof(void*). /// Generally used in combination with LLVM_ALIGNAS or when doing computation in @@ -323,12 +351,10 @@ #if __has_feature(memory_sanitizer) # define LLVM_MEMORY_SANITIZER_BUILD 1 # include -# define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE __attribute__((no_sanitize_memory)) #else # define LLVM_MEMORY_SANITIZER_BUILD 0 # define __msan_allocated_memory(p, size) # define __msan_unpoison(p, size) -# define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE #endif /// \macro LLVM_ADDRESS_SANITIZER_BUILD