mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:56:11 +00:00
[vm] Delete disallowed constructors/operators
This allows the compiler to emit better errors. It also allows the compiler to detect when a class accidentally references its own supposedly disallowed constructors/operators (e.g., see dartutils.cc). Notably, this exposes a number of private member variables that are unused, but some that are used only in certain build configurations. It would arguably be better to only define the variables when they're needed, but that's deferred to a subsequent CL. Change-Id: I5d0e6697eebebc9321fae1ff49cc68caf557b903 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97175 Commit-Queue: Siva Annamalai <asiva@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
parent
bbe8adc827
commit
a0e0a7a150
|
@ -152,6 +152,7 @@ config("dart_config") {
|
|||
"-Wall",
|
||||
"-Wextra", # Also known as -W.
|
||||
"-Wno-unused-parameter",
|
||||
"-Wno-unused-private-field",
|
||||
"-Wnon-virtual-dtor",
|
||||
"-Wvla",
|
||||
"-Wno-conversion-null",
|
||||
|
|
|
@ -801,9 +801,9 @@ Dart_Handle DartUtils::EnvironmentCallback(Dart_Handle name) {
|
|||
Dart_CObject CObject::api_null_ = {Dart_CObject_kNull, {0}};
|
||||
Dart_CObject CObject::api_true_ = {Dart_CObject_kBool, {true}};
|
||||
Dart_CObject CObject::api_false_ = {Dart_CObject_kBool, {false}};
|
||||
CObject CObject::null_ = CObject(&api_null_);
|
||||
CObject CObject::true_ = CObject(&api_true_);
|
||||
CObject CObject::false_ = CObject(&api_false_);
|
||||
CObject CObject::null_(&api_null_);
|
||||
CObject CObject::true_(&api_true_);
|
||||
CObject CObject::false_(&api_false_);
|
||||
|
||||
CObject* CObject::Null() {
|
||||
return &null_;
|
||||
|
|
|
@ -531,8 +531,8 @@ inline double MicrosecondsToMilliseconds(int64_t micros) {
|
|||
#if !defined(DISALLOW_COPY_AND_ASSIGN)
|
||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
private: \
|
||||
TypeName(const TypeName&); \
|
||||
void operator=(const TypeName&)
|
||||
TypeName(const TypeName&) = delete; \
|
||||
void operator=(const TypeName&) = delete
|
||||
#endif // !defined(DISALLOW_COPY_AND_ASSIGN)
|
||||
|
||||
// A macro to disallow all the implicit constructors, namely the default
|
||||
|
@ -543,7 +543,7 @@ inline double MicrosecondsToMilliseconds(int64_t micros) {
|
|||
#if !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
|
||||
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
|
||||
private: \
|
||||
TypeName(); \
|
||||
TypeName() = delete; \
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
#endif // !defined(DISALLOW_IMPLICIT_CONSTRUCTORS)
|
||||
|
||||
|
|
|
@ -166,10 +166,10 @@ class Symbols;
|
|||
\
|
||||
private: /* NOLINT */ \
|
||||
void* operator new(size_t size); \
|
||||
object(const object& value); \
|
||||
void operator=(Raw##super* value); \
|
||||
void operator=(const object& value); \
|
||||
void operator=(const super& value);
|
||||
object(const object& value) = delete; \
|
||||
void operator=(Raw##super* value) = delete; \
|
||||
void operator=(const object& value) = delete; \
|
||||
void operator=(const super& value) = delete;
|
||||
|
||||
// Conditionally include object_service.cc functionality in the vtable to avoid
|
||||
// link errors like the following:
|
||||
|
|
Loading…
Reference in a new issue