Commit 81290c48 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

cppgc: Use static_assert to force semi colon after macro

Bug: chromium:1056170
Change-Id: I1b6787ecea6ad58173a0bcc8e8d0862a5b19d299
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2199342
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67784}
parent bf251848
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <type_traits> #include <type_traits>
#include "cppgc/internal/api-constants.h" #include "cppgc/internal/api-constants.h"
#include "cppgc/macros.h"
#include "cppgc/platform.h" #include "cppgc/platform.h"
#include "cppgc/trace-trait.h" #include "cppgc/trace-trait.h"
#include "cppgc/type-traits.h" #include "cppgc/type-traits.h"
...@@ -161,7 +160,7 @@ class GarbageCollectedMixin : public internal::GarbageCollectedBase { ...@@ -161,7 +160,7 @@ class GarbageCollectedMixin : public internal::GarbageCollectedBase {
} \ } \
\ \
private: \ private: \
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro static_assert(true, "Force semicolon.")
/** /**
* Merge two or more Mixins into one. * Merge two or more Mixins into one.
...@@ -185,7 +184,7 @@ class GarbageCollectedMixin : public internal::GarbageCollectedBase { ...@@ -185,7 +184,7 @@ class GarbageCollectedMixin : public internal::GarbageCollectedBase {
} \ } \
\ \
private: \ private: \
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro static_assert(true, "Force semicolon.")
} // namespace cppgc } // namespace cppgc
......
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
namespace cppgc { namespace cppgc {
namespace internal {
class __thisIsHereToForceASemicolonAfterThisMacro {};
} // namespace internal
// Use if the object is only stack allocated. // Use if the object is only stack allocated.
#define CPPGC_STACK_ALLOCATED() \ #define CPPGC_STACK_ALLOCATED() \
public: \ public: \
...@@ -19,7 +15,7 @@ class __thisIsHereToForceASemicolonAfterThisMacro {}; ...@@ -19,7 +15,7 @@ class __thisIsHereToForceASemicolonAfterThisMacro {};
private: \ private: \
void* operator new(size_t) = delete; \ void* operator new(size_t) = delete; \
void* operator new(size_t, void*) = delete; \ void* operator new(size_t, void*) = delete; \
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro static_assert(true, "Force semicolon.")
} // namespace cppgc } // namespace cppgc
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "cppgc/internal/compiler-specific.h" #include "cppgc/internal/compiler-specific.h"
#include "cppgc/internal/prefinalizer-handler.h" #include "cppgc/internal/prefinalizer-handler.h"
#include "cppgc/liveness-broker.h" #include "cppgc/liveness-broker.h"
#include "cppgc/macros.h"
namespace cppgc { namespace cppgc {
...@@ -47,7 +46,7 @@ class PrefinalizerRegistration final { ...@@ -47,7 +46,7 @@ class PrefinalizerRegistration final {
private: \ private: \
CPPGC_NO_UNIQUE_ADDRESS internal::PrefinalizerRegistration<Class> \ CPPGC_NO_UNIQUE_ADDRESS internal::PrefinalizerRegistration<Class> \
prefinalizer_dummy_{this}; \ prefinalizer_dummy_{this}; \
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro static_assert(true, "Force semicolon.")
} // namespace cppgc } // namespace cppgc
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "include/cppgc/internal/gc-info.h" #include "include/cppgc/internal/gc-info.h"
#include "include/cppgc/internal/persistent-node.h" #include "include/cppgc/internal/persistent-node.h"
#include "include/cppgc/liveness-broker.h" #include "include/cppgc/liveness-broker.h"
#include "include/cppgc/macros.h"
#include "src/base/page-allocator.h" #include "src/base/page-allocator.h"
#include "src/heap/cppgc/heap-object-header.h" #include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/marker.h" #include "src/heap/cppgc/marker.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment