LLVM API Documentation
00001 //===-- llvm/Support/Compiler.h - Compiler abstraction support --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines several macros, based on the current compiler. This allows 00011 // use of compiler-specific features in a way that remains portable. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_SUPPORT_COMPILER_H 00016 #define LLVM_SUPPORT_COMPILER_H 00017 00018 // The VISIBILITY_HIDDEN macro, used for marking classes with the GCC-specific 00019 // visibility("hidden") attribute. 00020 #if (__GNUC__ >= 4) && !defined(__MINGW32__) && !defined(__CYGWIN__) 00021 #define VISIBILITY_HIDDEN __attribute__ ((visibility("hidden"))) 00022 #else 00023 #define VISIBILITY_HIDDEN 00024 #endif 00025 00026 #if (__GNUC__ >= 4) 00027 #define ATTRIBUTE_USED __attribute__((__used__)) 00028 #else 00029 #define ATTRIBUTE_USED 00030 #endif 00031 00032 // C++ doesn't support 'extern template' of template specializations. GCC does, 00033 // but requires __extension__ before it. In the header, use this: 00034 // EXTERN_TEMPLATE_INSTANTIATION(class foo<bar>); 00035 // in the .cpp file, use this: 00036 // TEMPLATE_INSTANTIATION(class foo<bar>); 00037 #ifdef __GNUC__ 00038 #define EXTERN_TEMPLATE_INSTANTIATION(X) __extension__ extern template X 00039 #define TEMPLATE_INSTANTIATION(X) template X 00040 #else 00041 #define EXTERN_TEMPLATE_INSTANTIATION(X) 00042 #define TEMPLATE_INSTANTIATION(X) 00043 #endif 00044 00045 // DISABLE_INLINE - On compilers where we have a directive to do so, mark a 00046 // method "not for inlining". 00047 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 00048 #define DISABLE_INLINE __attribute__((noinline)) 00049 #else 00050 #define DISABLE_INLINE 00051 #endif 00052 00053 #endif
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.