11cb0ef41Sopenharmony_ci// Copyright 2020 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ 61cb0ef41Sopenharmony_ci#define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cinamespace cppgc { 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci#if defined(__has_attribute) 111cb0ef41Sopenharmony_ci#define CPPGC_HAS_ATTRIBUTE(FEATURE) __has_attribute(FEATURE) 121cb0ef41Sopenharmony_ci#else 131cb0ef41Sopenharmony_ci#define CPPGC_HAS_ATTRIBUTE(FEATURE) 0 141cb0ef41Sopenharmony_ci#endif 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci#if defined(__has_cpp_attribute) 171cb0ef41Sopenharmony_ci#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE) 181cb0ef41Sopenharmony_ci#else 191cb0ef41Sopenharmony_ci#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) 0 201cb0ef41Sopenharmony_ci#endif 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci// [[no_unique_address]] comes in C++20 but supported in clang with -std >= 231cb0ef41Sopenharmony_ci// c++11. 241cb0ef41Sopenharmony_ci#if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address) 251cb0ef41Sopenharmony_ci#define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]] 261cb0ef41Sopenharmony_ci#else 271cb0ef41Sopenharmony_ci#define CPPGC_NO_UNIQUE_ADDRESS 281cb0ef41Sopenharmony_ci#endif 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci#if CPPGC_HAS_ATTRIBUTE(unused) 311cb0ef41Sopenharmony_ci#define CPPGC_UNUSED __attribute__((unused)) 321cb0ef41Sopenharmony_ci#else 331cb0ef41Sopenharmony_ci#define CPPGC_UNUSED 341cb0ef41Sopenharmony_ci#endif 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci} // namespace cppgc 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci#endif // INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ 39