~ubuntu-branches/ubuntu/oneiric/lightning-extension/oneiric-security

« back to all changes in this revision

Viewing changes to mozilla/mfbt/Attributes.h

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-04-20 13:46:11 UTC
  • mfrom: (1.2.1)
  • mto: (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20120420134611-i0dkosnbmihrd0lr
Tags: upstream-1.4+build1
ImportĀ upstreamĀ versionĀ 1.4+build1

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 */
50
50
 
51
51
/*
 
52
 * MOZ_INLINE is a macro which expands to tell the compiler that the method
 
53
 * decorated with it should be inlined.  This macro is usable from C and C++
 
54
 * code, even though C89 does not support the |inline| keyword.  The compiler
 
55
 * may ignore this directive if it chooses.
 
56
 */
 
57
#if defined(__cplusplus)
 
58
#  define MOZ_INLINE            inline
 
59
#elif defined(_MSC_VER)
 
60
#  define MOZ_INLINE            __inline
 
61
#elif defined(__GNUC__)
 
62
#  define MOZ_INLINE            __inline__
 
63
#else
 
64
#  define MOZ_INLINE            inline
 
65
#endif
 
66
 
 
67
/*
 
68
 * MOZ_ALWAYS_INLINE is a macro which expands to tell the compiler that the
 
69
 * method decorated with it must be inlined, even if the compiler thinks
 
70
 * otherwise.  This is only a (much) stronger version of the MOZ_INLINE hint:
 
71
 * compilers are not guaranteed to respect it (although they're much more likely
 
72
 * to do so).
 
73
 */
 
74
#if defined(DEBUG)
 
75
#  define MOZ_ALWAYS_INLINE     MOZ_INLINE
 
76
#elif defined(_MSC_VER)
 
77
#  define MOZ_ALWAYS_INLINE     __forceinline
 
78
#elif defined(__GNUC__)
 
79
#  define MOZ_ALWAYS_INLINE     __attribute__((always_inline)) MOZ_INLINE
 
80
#else
 
81
#  define MOZ_ALWAYS_INLINE     MOZ_INLINE
 
82
#endif
 
83
 
 
84
/*
52
85
 * g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
53
86
 * without warnings (functionality used by the macros below).  These modes are
54
87
 * detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, more
72
105
#    define MOZ_HAVE_CXX11_OVERRIDE
73
106
#    define MOZ_HAVE_CXX11_FINAL         final
74
107
#  endif
 
108
#  if __has_attribute(noinline)
 
109
#    define MOZ_HAVE_NEVER_INLINE        __attribute__((noinline))
 
110
#  endif
75
111
#  if __has_attribute(noreturn)
76
112
#    define MOZ_HAVE_NORETURN            __attribute__((noreturn))
77
113
#  endif
100
136
#      endif
101
137
#    endif
102
138
#  endif
 
139
#  define MOZ_HAVE_NEVER_INLINE          __attribute__((noinline))
103
140
#  define MOZ_HAVE_NORETURN              __attribute__((noreturn))
104
141
#elif defined(_MSC_VER)
105
142
#  if _MSC_VER >= 1400
107
144
     /* MSVC currently spells "final" as "sealed". */
108
145
#    define MOZ_HAVE_CXX11_FINAL         sealed
109
146
#  endif
 
147
#  define MOZ_HAVE_NEVER_INLINE          __declspec(noinline)
110
148
#  define MOZ_HAVE_NORETURN              __declspec(noreturn)
111
149
#endif
112
150
 
113
151
/*
 
152
 * MOZ_NEVER_INLINE is a macro which expands to tell the compiler that the
 
153
 * method decorated with it must never be inlined, even if the compiler would
 
154
 * otherwise choose to inline the method.  Compilers aren't absolutely
 
155
 * guaranteed to support this, but most do.
 
156
 */
 
157
#if defined(MOZ_HAVE_NEVER_INLINE)
 
158
#  define MOZ_NEVER_INLINE      MOZ_HAVE_NEVER_INLINE
 
159
#else
 
160
#  define MOZ_NEVER_INLINE      /* no support */
 
161
#endif
 
162
 
 
163
/*
114
164
 * MOZ_NORETURN, specified at the start of a function declaration, indicates
115
165
 * that the given function does not return.  (The function definition does not
116
166
 * need to be annotated.)