Files
Omer Katz 22c8aabfbc Reland "[cppgc] Use blink_gc_plugin in v8"
This is a reland of commit 017b2a5132

Original change's description:
> [cppgc] Use blink_gc_plugin in v8
>
> This CL enables the plugin for v8 builds and fixes various violations
> found in the v8 codebase.
>
> Some ignore annotations remain for changes required in the plugin (e.g.
> treat TraceMultiple and TraceEphemeron as trace methods).
>
> Bug: 402564649
> Change-Id: I3f995cf2bf31672b7c5702338286cfb850af2dcf
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6366816
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Commit-Queue: Omer Katz <omerkatz@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#99316}

Bug: 402564649
Change-Id: Ibb4c9efdd6f26a9d7de234c4f341b754c96fc345
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6369299
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99323}
2025-03-19 01:21:48 -07:00

57 lines
2.0 KiB
C++

// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef INCLUDE_CPPGC_MACROS_H_
#define INCLUDE_CPPGC_MACROS_H_
#include <cstddef>
#include "cppgc/internal/compiler-specific.h"
namespace cppgc {
#define CPPGC_DISALLOW_NEW() \
public: \
using IsDisallowNewMarker CPPGC_UNUSED = int; \
void* operator new(size_t, void* location) { return location; } \
void* operator new(size_t) = delete; \
static_assert(true, "Force semicolon.")
// Use CPPGC_STACK_ALLOCATED if the object is only stack allocated.
// Add the CPPGC_STACK_ALLOCATED_IGNORE annotation on a case-by-case basis when
// enforcement of CPPGC_STACK_ALLOCATED should be suppressed.
#if defined(__clang__)
#define CPPGC_STACK_ALLOCATED() \
public: \
using IsStackAllocatedTypeMarker CPPGC_UNUSED = int; \
\
private: \
void* operator new(size_t) = delete; \
void* operator new(size_t, void*) = delete; \
static_assert(true, "Force semicolon.")
#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason) \
__attribute__((annotate("stack_allocated_ignore")))
#define CPPGC_PLUGIN_IGNORE(bug_or_reason) \
__attribute__((annotate("blink_gc_plugin_ignore"), \
annotate("stack_allocated_ignore")))
#else // !defined(__clang__)
#define CPPGC_STACK_ALLOCATED() static_assert(true, "Force semicolon.")
#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason)
#define CPPGC_PLUGIN_IGNORE(bug_or_reason)
#endif // !defined(__clang__)
template <typename T>
concept IsStackAllocatedType =
requires { typename T::IsStackAllocatedTypeMarker; };
} // namespace cppgc
#endif // INCLUDE_CPPGC_MACROS_H_