diff --git a/build/target.cmake b/build/target.cmake index 2f24ebea9..651d22a0b 100644 --- a/build/target.cmake +++ b/build/target.cmake @@ -60,10 +60,14 @@ ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") -fvisibility=hidden -fno-fast-math -fno-unsafe-math-optimizations -fdenormal-fp-math=ieee -Wno-type-limits -Wno-unused-result -Wno-unused-variable -Wno-invalid-offsetof -Wno-unused-function - -Wno-deprecated-declarations -Wno-unsupported-floating-point-opt -Wno-parentheses-equality -Wno-dynamic-class-memaccess -Wno-deprecated-register + -Wno-deprecated-declarations -Wno-parentheses-equality -Wno-dynamic-class-memaccess -Wno-deprecated-register -Wno-expansion-to-defined -Wno-return-type -Wno-overloaded-virtual -Wno-unused-private-field -Wno-deprecated-copy -Wno-atomic-alignment -Wno-ambiguous-reversed-operator -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion -Wno-braced-scalar-init -Wno-unused-parameter ) + IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 10) + # this feature supported after clang version 11 + SET (ESCARGOT_CXXFLAGS ${ESCARGOT_CXXFLAGS} -Wno-unsupported-floating-point-opt) + endif() SET (ESCARGOT_CXXFLAGS_DEBUG -O0 -Wall -Wextra -Werror) SET (ESCARGOT_CXXFLAGS_RELEASE -O2 -fno-stack-protector -fno-omit-frame-pointer) SET (ESCARGOT_THIRDPARTY_CFLAGS -w -g3 -fdata-sections -ffunction-sections -fno-omit-frame-pointer -fvisibility=hidden) diff --git a/src/parser/Lexer.cpp b/src/parser/Lexer.cpp index 1ad8df5e2..e9591f396 100644 --- a/src/parser/Lexer.cpp +++ b/src/parser/Lexer.cpp @@ -1779,7 +1779,7 @@ void Scanner::scanTemplate(Scanner::ScannerResult* token, bool head) } break; } - auto endIndex = this->index; + auto endIndex = this->eof() ? this->length : this->index; for (size_t i = currentIndex; i < endIndex; i++) { raw += this->sourceCharAt(i); } diff --git a/src/runtime/BooleanObject.h b/src/runtime/BooleanObject.h index b16962d58..b58524426 100644 --- a/src/runtime/BooleanObject.h +++ b/src/runtime/BooleanObject.h @@ -39,7 +39,7 @@ class BooleanObject : public DerivedObject { m_primitiveValue = val; } - virtual bool isBooleanObject() const + virtual bool isBooleanObject() const override { return true; } diff --git a/src/runtime/DateObject.h b/src/runtime/DateObject.h index b4a353431..101c1b7dd 100644 --- a/src/runtime/DateObject.h +++ b/src/runtime/DateObject.h @@ -76,7 +76,7 @@ class DateObject : public DerivedObject { return IS_VALID_TIME(m_primitiveValue); } - virtual bool isDateObject() const + virtual bool isDateObject() const override { return true; } diff --git a/src/runtime/ErrorObject.h b/src/runtime/ErrorObject.h index 549c4b86e..be51a1a5f 100644 --- a/src/runtime/ErrorObject.h +++ b/src/runtime/ErrorObject.h @@ -174,7 +174,7 @@ class ErrorObject : public DerivedObject { ErrorObject(ExecutionState& state, Object* proto, String* errorMessage, bool fillStackInfo = true, bool triggerCallback = false); void updateStackTraceData(ExecutionState& state); - virtual bool isErrorObject() const + virtual bool isErrorObject() const override { return true; } diff --git a/src/runtime/ExtendedNativeFunctionObject.h b/src/runtime/ExtendedNativeFunctionObject.h index 04e2df20a..d2ea11684 100644 --- a/src/runtime/ExtendedNativeFunctionObject.h +++ b/src/runtime/ExtendedNativeFunctionObject.h @@ -26,7 +26,7 @@ namespace Escargot { class ExtendedNativeFunctionObject : public NativeFunctionObject { public: - virtual bool isExtendedNativeFunctionObject() const + virtual bool isExtendedNativeFunctionObject() const override { return true; } diff --git a/src/runtime/FinalizationRegistryObject.h b/src/runtime/FinalizationRegistryObject.h index c5e8d70b6..edeae55cd 100644 --- a/src/runtime/FinalizationRegistryObject.h +++ b/src/runtime/FinalizationRegistryObject.h @@ -54,7 +54,7 @@ class FinalizationRegistryObject : public DerivedObject { explicit FinalizationRegistryObject(ExecutionState& state, Object* cleanupCallback, Context* realm); explicit FinalizationRegistryObject(ExecutionState& state, Object* proto, Object* cleanupCallback, Context* realm); - virtual bool isFinalizationRegistryObject() const + virtual bool isFinalizationRegistryObject() const override { return true; } diff --git a/src/runtime/IteratorObject.h b/src/runtime/IteratorObject.h index 394074c54..66f77a44d 100644 --- a/src/runtime/IteratorObject.h +++ b/src/runtime/IteratorObject.h @@ -55,7 +55,7 @@ class IteratorObject : public DerivedObject { explicit IteratorObject(ExecutionState& state); explicit IteratorObject(ExecutionState& state, Object* proto); - virtual bool isIteratorObject() const + virtual bool isIteratorObject() const override { return true; } diff --git a/src/runtime/NumberObject.h b/src/runtime/NumberObject.h index 552bbe99f..8f1441f9b 100644 --- a/src/runtime/NumberObject.h +++ b/src/runtime/NumberObject.h @@ -42,7 +42,7 @@ class NumberObject : public DerivedObject { m_primitiveValue = data; } - virtual bool isNumberObject() const + virtual bool isNumberObject() const override { return true; } diff --git a/src/runtime/Object.h b/src/runtime/Object.h index 440c74599..f14e1b2f9 100644 --- a/src/runtime/Object.h +++ b/src/runtime/Object.h @@ -296,7 +296,7 @@ class JSGetterSetter : public PointerValue { ASSERT(setter.isEmpty() || setter.isCallable() || setter.isUndefined()); } - virtual bool isJSGetterSetter() const + virtual bool isJSGetterSetter() const override { return true; } diff --git a/src/runtime/PromiseObject.h b/src/runtime/PromiseObject.h index 3f9d089e4..ac4ed68d1 100644 --- a/src/runtime/PromiseObject.h +++ b/src/runtime/PromiseObject.h @@ -103,7 +103,7 @@ class PromiseObject : public DerivedObject { explicit PromiseObject(ExecutionState& state); explicit PromiseObject(ExecutionState& state, Object* proto); - virtual bool isPromiseObject() const + virtual bool isPromiseObject() const override { return true; } diff --git a/src/runtime/TypedArrayObject.h b/src/runtime/TypedArrayObject.h index 86f1278d2..1103dcbf6 100644 --- a/src/runtime/TypedArrayObject.h +++ b/src/runtime/TypedArrayObject.h @@ -44,7 +44,7 @@ class TypedArrayPrototypeObject : public DerivedObject { { } - virtual bool isTypedArrayPrototypeObject() const + virtual bool isTypedArrayPrototypeObject() const override { return true; } diff --git a/src/runtime/WeakMapObject.h b/src/runtime/WeakMapObject.h index 71bb78c82..3cfa16715 100644 --- a/src/runtime/WeakMapObject.h +++ b/src/runtime/WeakMapObject.h @@ -39,7 +39,7 @@ class WeakMapObject : public DerivedObject { explicit WeakMapObject(ExecutionState& state); explicit WeakMapObject(ExecutionState& state, Object* proto); - virtual bool isWeakMapObject() const + virtual bool isWeakMapObject() const override { return true; } diff --git a/src/runtime/WeakRefObject.h b/src/runtime/WeakRefObject.h index 5949e2840..ce8d47769 100644 --- a/src/runtime/WeakRefObject.h +++ b/src/runtime/WeakRefObject.h @@ -32,7 +32,7 @@ class WeakRefObject : public DerivedObject { explicit WeakRefObject(ExecutionState& state, PointerValue* target); explicit WeakRefObject(ExecutionState& state, Object* proto, PointerValue* target); - virtual bool isWeakRefObject() const + virtual bool isWeakRefObject() const override { return true; } diff --git a/src/runtime/WeakSetObject.h b/src/runtime/WeakSetObject.h index d329ceb61..e20d76232 100644 --- a/src/runtime/WeakSetObject.h +++ b/src/runtime/WeakSetObject.h @@ -31,7 +31,7 @@ class WeakSetObject : public DerivedObject { explicit WeakSetObject(ExecutionState& state); explicit WeakSetObject(ExecutionState& state, Object* proto); - virtual bool isWeakSetObject() const + virtual bool isWeakSetObject() const override { return true; } diff --git a/third_party/walrus b/third_party/walrus index 7800a31ea..75dc3e4eb 160000 --- a/third_party/walrus +++ b/third_party/walrus @@ -1 +1 @@ -Subproject commit 7800a31eacf47663cdf21c299ae6e6d4d7550af8 +Subproject commit 75dc3e4eb8ba92a1b064a8b7322be0faaf9d7d68