Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-02 08:54:42

0001 // Copyright 2020 the V8 project authors. All rights reserved.
0002 // Use of this source code is governed by a BSD-style license that can be
0003 // found in the LICENSE file.
0004 
0005 #ifndef INCLUDE_CPPGC_MACROS_H_
0006 #define INCLUDE_CPPGC_MACROS_H_
0007 
0008 #include <cstddef>
0009 
0010 #include "cppgc/internal/compiler-specific.h"
0011 
0012 namespace cppgc {
0013 
0014 // Use CPPGC_STACK_ALLOCATED if the object is only stack allocated.
0015 // Add the CPPGC_STACK_ALLOCATED_IGNORE annotation on a case-by-case basis when
0016 // enforcement of CPPGC_STACK_ALLOCATED should be suppressed.
0017 #if defined(__clang__)
0018 #define CPPGC_STACK_ALLOCATED()                        \
0019  public:                                               \
0020   using IsStackAllocatedTypeMarker CPPGC_UNUSED = int; \
0021                                                        \
0022  private:                                              \
0023   void* operator new(size_t) = delete;                 \
0024   void* operator new(size_t, void*) = delete;          \
0025   static_assert(true, "Force semicolon.")
0026 #define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason) \
0027   __attribute__((annotate("stack_allocated_ignore")))
0028 #else  // !defined(__clang__)
0029 #define CPPGC_STACK_ALLOCATED() static_assert(true, "Force semicolon.")
0030 #define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason)
0031 #endif  // !defined(__clang__)
0032 
0033 }  // namespace cppgc
0034 
0035 #endif  // INCLUDE_CPPGC_MACROS_H_