1 //===-- llvm/Support/Compiler.h - Compiler abstraction support --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Chris Lattner and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines several macros, based on the current compiler. This allows
11 // use of compiler-specific features in a way that remains portable.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SUPPORT_COMPILER_H
16 #define LLVM_SUPPORT_COMPILER_H
18 // The VISIBILITY_HIDDEN macro, used for marking classes with the GCC-specific
19 // visibility("hidden") attribute.
21 #define VISIBILITY_HIDDEN __attribute__ ((visibility("hidden")))
23 #define VISIBILITY_HIDDEN
27 // C++ doesn't support 'extern template' of template specializations. GCC does,
28 // but requires __extension__ before it. In the header, use this:
29 // EXTERN_TEMPLATE_INSTANTIATION(class foo<bar>);
30 // in the .cpp file, use this:
31 // TEMPLATE_INSTANTIATION(class foo<bar>);
33 #define EXTERN_TEMPLATE_INSTANTIATION(X) __extension__ extern template X
34 #define TEMPLATE_INSTANTIATION(X) template X
36 #define EXTERN_TEMPLATE_INSTANTIATION(X)
37 #define TEMPLATE_INSTANTIATION(X)
40 // DISABLE_INLINE - On compilers where we have a directive to do so, mark a
41 // method "not for inlining".
42 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
43 #define DISABLE_INLINE __attribute__((noinline))
45 #define DISABLE_INLINE