v8  9.4.146 (node 16.13.0)
V8 is Google's open source JavaScript engine
compiler-specific.h
Go to the documentation of this file.
1 // Copyright 2020 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
6 #define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
7 
8 namespace cppgc {
9 
10 #if defined(__has_attribute)
11 #define CPPGC_HAS_ATTRIBUTE(FEATURE) __has_attribute(FEATURE)
12 #else
13 #define CPPGC_HAS_ATTRIBUTE(FEATURE) 0
14 #endif
15 
16 #if defined(__has_cpp_attribute)
17 #define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
18 #else
19 #define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) 0
20 #endif
21 
22 // [[no_unique_address]] comes in C++20 but supported in clang with -std >=
23 // c++11.
24 #if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
25 #define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]]
26 #else
27 #define CPPGC_NO_UNIQUE_ADDRESS
28 #endif
29 
30 #if CPPGC_HAS_ATTRIBUTE(unused)
31 #define CPPGC_UNUSED __attribute__((unused))
32 #else
33 #define CPPGC_UNUSED
34 #endif
35 
36 } // namespace cppgc
37 
38 #endif // INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_