Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: include/v8config.h

Issue 1212163003: Using "defined" in macro causes undefined behavior. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8CONFIG_H_ 5 #ifndef V8CONFIG_H_
6 #define V8CONFIG_H_ 6 #define V8CONFIG_H_
7 7
8 // clang-format off
9
8 // Platform headers for feature detection below. 10 // Platform headers for feature detection below.
9 #if defined(__ANDROID__) 11 #if defined(__ANDROID__)
10 # include <sys/cdefs.h> 12 # include <sys/cdefs.h>
11 #elif defined(__APPLE__) 13 #elif defined(__APPLE__)
12 # include <TargetConditionals.h> 14 # include <TargetConditionals.h>
13 #elif defined(__linux__) 15 #elif defined(__linux__)
14 # include <features.h> 16 # include <features.h>
15 #endif 17 #endif
16 18
17 19
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow)) 225 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
224 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow)) 226 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
225 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow)) 227 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
226 228
227 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) 229 # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas))
228 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) 230 # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert))
229 231
230 #elif defined(__GNUC__) 232 #elif defined(__GNUC__)
231 233
232 # define V8_CC_GNU 1 234 # define V8_CC_GNU 1
233 // Intel C++ also masquerades as GCC 3.2.0 235 # if defined(__INTEL_COMPILER) // Intel C++ also masquerades as GCC 3.2.0
234 # define V8_CC_INTEL (defined(__INTEL_COMPILER)) 236 # define V8_CC_INTEL 1
235 # define V8_CC_MINGW32 (defined(__MINGW32__)) 237 # endif
236 # define V8_CC_MINGW64 (defined(__MINGW64__)) 238 # if defined(__MINGW32__)
239 # define V8_CC_MINGW32 1
240 # endif
241 # if defined(__MINGW64__)
242 # define V8_CC_MINGW64 1
243 # endif
237 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64) 244 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
238 245
239 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0)) 246 # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0))
240 247
241 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0)) 248 # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0))
242 // always_inline is available in gcc 4.0 but not very reliable until 4.4. 249 // always_inline is available in gcc 4.0 but not very reliable until 4.4.
243 // Works around "sorry, unimplemented: inlining failed" build errors with 250 // Works around "sorry, unimplemented: inlining failed" build errors with
244 // older compilers. 251 // older compilers.
245 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0)) 252 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
246 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) 253 # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 412
406 // Annotate a function indicating the caller must examine the return value. 413 // Annotate a function indicating the caller must examine the return value.
407 // Use like: 414 // Use like:
408 // int foo() WARN_UNUSED_RESULT; 415 // int foo() WARN_UNUSED_RESULT;
409 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT 416 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
410 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 417 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
411 #else 418 #else
412 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */ 419 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
413 #endif 420 #endif
414 421
422 // clang-format on
423
415 #endif // V8CONFIG_H_ 424 #endif // V8CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698