v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
macros.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_MACROS_H_
6
#define INCLUDE_CPPGC_MACROS_H_
7
8
#include <cstddef>
9
10
#include "
cppgc/internal/compiler-specific.h
"
11
12
namespace
cppgc
{
13
14
#define CPPGC_DISALLOW_NEW() \
15
public: \
16
using IsDisallowNewMarker CPPGC_UNUSED = int; \
17
void* operator new(size_t, void* location) { return location; } \
18
void* operator new(size_t) = delete; \
19
static_assert(true, "Force semicolon.")
20
21
// Use CPPGC_STACK_ALLOCATED if the object is only stack allocated.
22
// Add the CPPGC_STACK_ALLOCATED_IGNORE annotation on a case-by-case basis when
23
// enforcement of CPPGC_STACK_ALLOCATED should be suppressed.
24
#if defined(__clang__)
25
26
#define CPPGC_STACK_ALLOCATED() \
27
public: \
28
using IsStackAllocatedTypeMarker CPPGC_UNUSED = int; \
29
\
30
private: \
31
void* operator new(size_t) = delete; \
32
void* operator new(size_t, void*) = delete; \
33
static_assert(true, "Force semicolon.")
34
35
#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason) \
36
__attribute__((annotate("stack_allocated_ignore")))
37
38
#define CPPGC_PLUGIN_IGNORE(bug_or_reason) \
39
__attribute__((annotate("blink_gc_plugin_ignore"), \
40
annotate("stack_allocated_ignore")))
41
42
#else
// !defined(__clang__)
43
44
#define CPPGC_STACK_ALLOCATED() static_assert(true, "Force semicolon.")
45
#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason)
46
#define CPPGC_PLUGIN_IGNORE(bug_or_reason)
47
48
#endif
// !defined(__clang__)
49
50
template
<
typename
T>
51
concept
IsStackAllocatedType
=
52
requires
{
typename
T::IsStackAllocatedTypeMarker; };
53
54
}
// namespace cppgc
55
56
#endif
// INCLUDE_CPPGC_MACROS_H_
cppgc::IsStackAllocatedType
Definition
macros.h:51
compiler-specific.h
cppgc
Definition
cross-heap-remembered-set.h:14
include
cppgc
macros.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0