v8  9.0.257(node16.0.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) // NOLINTNEXTLINE
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) // NOLINTNEXTLINE
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_
CPPGC_HAS_ATTRIBUTE
#define CPPGC_HAS_ATTRIBUTE(FEATURE)
Definition: compiler-specific.h:13
cppgc
Definition: allocation.h:17
CPPGC_HAS_CPP_ATTRIBUTE
#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE)
Definition: compiler-specific.h:19