diff --git a/LICENSE b/LICENSE index d645695..30e5769 100644 --- a/LICENSE +++ b/LICENSE @@ -176,17 +176,6 @@ END OF TERMS AND CONDITIONS - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/assembler/assembly-emitter.cpp b/assembler/assembly-emitter.cpp index def9ae2..31d4d4b 100644 --- a/assembler/assembly-emitter.cpp +++ b/assembler/assembly-emitter.cpp @@ -15,7 +15,6 @@ #include "assembly-emitter.h" -#include #include #include #include diff --git a/disassembler/disassembler.cpp b/disassembler/disassembler.cpp index e21a44a..190a32b 100644 --- a/disassembler/disassembler.cpp +++ b/disassembler/disassembler.cpp @@ -1258,7 +1258,7 @@ pandasm::extensions::Language Disassembler::PFLangToPandasmLang( std::string Disassembler::StringDataToString(panda_file::File::StringData sd) const { - std::string res((char *)sd.data); + std::string res(reinterpret_cast(const_cast(sd.data))); return res; } diff --git a/libpandabase/macros.h b/libpandabase/macros.h index 13ba4f0..5041b4d 100644 --- a/libpandabase/macros.h +++ b/libpandabase/macros.h @@ -216,10 +216,10 @@ #define NO_THREAD_SANITIZE __attribute__((no_sanitize("thread"))) // NOLINT(cppcoreguidelines-macro-usage) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TSAN_ANNOTATE_HAPPENS_BEFORE(addr) \ - AnnotateHappensBefore(__FILE__, __LINE__, (void*)(addr)) + AnnotateHappensBefore(__FILE__, __LINE__, reinterpret_cast(addr)) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TSAN_ANNOTATE_HAPPENS_AFTER(addr) \ - AnnotateHappensAfter(__FILE__, __LINE__, (void*)(addr)) + AnnotateHappensAfter(__FILE__, __LINE__, reinterpret_cast(addr)) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TSAN_ANNOTATE_IGNORE_WRITES_BEGIN() \ @@ -243,10 +243,10 @@ extern "C" void AnnotateIgnoreWritesEnd(const char* f, int l); #define NO_THREAD_SANITIZE __attribute__((no_sanitize("thread"))) // NOLINT(cppcoreguidelines-macro-usage) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TSAN_ANNOTATE_HAPPENS_BEFORE(addr) \ - AnnotateHappensBefore(__FILE__, __LINE__, (void*)(addr)) + AnnotateHappensBefore(__FILE__, __LINE__, reinterpret_cast(addr)) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TSAN_ANNOTATE_HAPPENS_AFTER(addr) \ - AnnotateHappensAfter(__FILE__, __LINE__, (void*)(addr)) + AnnotateHappensAfter(__FILE__, __LINE__, reinterpret_cast(addr)) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define TSAN_ANNOTATE_IGNORE_WRITES_BEGIN() \ diff --git a/libpandabase/mem/alloc_tracker.h b/libpandabase/mem/alloc_tracker.h index 39e4ac0..8b298fa 100644 --- a/libpandabase/mem/alloc_tracker.h +++ b/libpandabase/mem/alloc_tracker.h @@ -37,9 +37,9 @@ public: virtual void TrackAlloc(void *addr, size_t size, SpaceType space) = 0; virtual void TrackFree(void *addr) = 0; - virtual void Dump() {}; - virtual void Dump([[maybe_unused]] std::ostream &out) {}; - virtual void DumpMemLeaks([[maybe_unused]] std::ostream &out) {}; + virtual void Dump() {} + virtual void Dump([[maybe_unused]] std::ostream &out) {} + virtual void DumpMemLeaks([[maybe_unused]] std::ostream &out) {} NO_COPY_SEMANTIC(AllocTracker); NO_MOVE_SEMANTIC(AllocTracker); diff --git a/libpandabase/mem/code_allocator.cpp b/libpandabase/mem/code_allocator.cpp index 9bc66ce..29236ac 100644 --- a/libpandabase/mem/code_allocator.cpp +++ b/libpandabase/mem/code_allocator.cpp @@ -14,9 +14,8 @@ */ #include "code_allocator.h" -#include "os/mem.h" -#include "trace/trace.h" #include "mem/base_mem_stats.h" +#include "os/mem.h" #include "trace/trace.h" #include diff --git a/libpandabase/os/unix/futex/mutex.h b/libpandabase/os/unix/futex/mutex.h index b2870ce..6886827 100644 --- a/libpandabase/os/unix/futex/mutex.h +++ b/libpandabase/os/unix/futex/mutex.h @@ -116,12 +116,12 @@ private: friend ConditionVariable; protected: - explicit Mutex(bool recursive) : recursive_mutex_(recursive) {}; + explicit Mutex(bool recursive) : recursive_mutex_(recursive) {} }; class CAPABILITY("mutex") RecursiveMutex : public Mutex { public: - RecursiveMutex() : Mutex(true) {}; + RecursiveMutex() : Mutex(true) {} ~RecursiveMutex() = default; diff --git a/libpandabase/utils/logger.h b/libpandabase/utils/logger.h index c32991c..28f964c 100644 --- a/libpandabase/utils/logger.h +++ b/libpandabase/utils/logger.h @@ -172,7 +172,7 @@ public: #undef D default: break; - }; + } UNREACHABLE(); return 0; diff --git a/libpandabase/utils/pandargs.h b/libpandabase/utils/pandargs.h index 6adb98a..ee63845 100644 --- a/libpandabase/utils/pandargs.h +++ b/libpandabase/utils/pandargs.h @@ -42,7 +42,9 @@ enum class PandArgType : uint8_t { STRING, INTEGER, DOUBLE, BOOL, LIST, UINT32, class PandArgBase { public: explicit PandArgBase(std::string name, std::string desc, PandArgType type = PandArgType::NOTYPE) - : name_(std::move(name)), desc_(std::move(desc)), type_(type) {}; + : name_(std::move(name)), desc_(std::move(desc)), type_(type) + { + } PandArgType GetType() const { @@ -71,7 +73,9 @@ template EvalType()), default_val_(default_val), real_val_(default_val) {}; + : PandArgBase(name, desc, this->EvalType()), default_val_(default_val), real_val_(default_val) + { + } explicit PandArg(const std::string &name, int default_val, const std::string &desc, T min_val, T max_val) : PandArgBase(name, desc, this->EvalType()), @@ -86,7 +90,7 @@ public: : PandArgBase(name, desc, PandArgType::LIST), default_val_(default_val), real_val_(default_val), - delimiter_(std::move(delimiter)) {}; + delimiter_(std::move(delimiter)) {} T GetValue() const { @@ -797,7 +801,7 @@ private: param_str_index = pos; param_str_index = param_str.find_first_not_of(delimiter, param_str_index); pos = param_str.find_first_of(delimiter, param_str_index); - }; + } value.push_back(param_str.substr(param_str_index, pos - param_str_index)); arg->SetValue(value); diff --git a/libpandabase/utils/type_helpers.h b/libpandabase/utils/type_helpers.h index 282a730..c833ee8 100644 --- a/libpandabase/utils/type_helpers.h +++ b/libpandabase/utils/type_helpers.h @@ -56,7 +56,7 @@ __extension__ using int128 = __int128; #include using int128 = struct int128_type { constexpr int128_type() = default; - constexpr explicit int128_type(std::int64_t v) : lo(v) {}; + constexpr explicit int128_type(std::int64_t v) : lo(v) {} std::int64_t hi {0}; std::int64_t lo {0}; bool operator==(std::int64_t v) const diff --git a/libpandafile/external/panda_file_external.h b/libpandafile/external/panda_file_external.h index 8dd4cac..91acf1e 100644 --- a/libpandafile/external/panda_file_external.h +++ b/libpandafile/external/panda_file_external.h @@ -103,7 +103,7 @@ public: ~PandaFileWrapper() = default; private: - explicit PandaFileWrapper(PandaFileExt *pf_ext) : pf_ext_(pf_ext) {}; + explicit PandaFileWrapper(PandaFileExt *pf_ext) : pf_ext_(pf_ext) {} PandaFileExt *pf_ext_; // callback diff --git a/libpandafile/file_items.h b/libpandafile/file_items.h index 1c3404c..da5d815 100644 --- a/libpandafile/file_items.h +++ b/libpandafile/file_items.h @@ -115,7 +115,7 @@ public: virtual size_t CalculateSize() const = 0; - virtual void ComputeLayout() {}; + virtual void ComputeLayout() {} virtual size_t Alignment() { diff --git a/libziparchive/tests/libziparchive_tests.cpp b/libziparchive/tests/libziparchive_tests.cpp index e419e9f..212146e 100644 --- a/libziparchive/tests/libziparchive_tests.cpp +++ b/libziparchive/tests/libziparchive_tests.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/runtime/core/core_class_linker_extension.cpp b/runtime/core/core_class_linker_extension.cpp index 016bb09..ab0cd30 100644 --- a/runtime/core/core_class_linker_extension.cpp +++ b/runtime/core/core_class_linker_extension.cpp @@ -50,7 +50,7 @@ void CoreClassLinkerExtension::ErrorHandler::OnError(ClassLinker::Error error, c default: LOG(FATAL, CLASS_LINKER) << "Unhandled error (" << static_cast(error) << "): " << message; break; - }; + } } // CODECHECK-NOLINTNEXTLINE(C_RULE_ID_FUNCTION_SIZE) diff --git a/runtime/core/core_vm.h b/runtime/core/core_vm.h index bd92968..5aef4ed 100644 --- a/runtime/core/core_vm.h +++ b/runtime/core/core_vm.h @@ -20,9 +20,8 @@ #include "libpandabase/utils/expected.h" #include "runtime/include/mem/panda_smart_pointers.h" #include "runtime/include/mem/panda_string.h" -#include "runtime/mem/gc/gc_phase.h" -#include "runtime/mem/refstorage/reference.h" #include "runtime/include/panda_vm.h" +#include "runtime/mem/gc/gc_phase.h" #include "runtime/mem/refstorage/reference.h" namespace panda { diff --git a/runtime/field.cpp b/runtime/field.cpp index 3b84126..8aeb4cd 100644 --- a/runtime/field.cpp +++ b/runtime/field.cpp @@ -68,7 +68,7 @@ Class *Field::ResolveTypeClass(ClassLinkerErrorHandler *error_handler) const error_handler); default: UNREACHABLE(); - }; + } } } // namespace panda diff --git a/runtime/include/cframe_iterators.h b/runtime/include/cframe_iterators.h index fc5cc78..3a04ffd 100644 --- a/runtime/include/cframe_iterators.h +++ b/runtime/include/cframe_iterators.h @@ -21,7 +21,6 @@ #include "runtime/arch/helpers.h" #include "runtime/include/cframe.h" #include "runtime/include/method.h" -#include "libpandafile/shorty_iterator.h" #include "utils/bit_utils.h" namespace panda { diff --git a/runtime/include/mem/allocator.h b/runtime/include/mem/allocator.h index 07ee6b7..7fe9364 100644 --- a/runtime/include/mem/allocator.h +++ b/runtime/include/mem/allocator.h @@ -569,6 +569,7 @@ class ObjectAllocatorNoGen final : public ObjectAllocatorBase { using ObjectAllocator = RunSlotsAllocator; // Allocator used for middle size allocations using LargeObjectAllocator = FreeListAllocator; // Allocator used for large objects using HumongousObjectAllocator = HumongousObjAllocator; // Allocator used for humongous objects + public: NO_MOVE_SEMANTIC(ObjectAllocatorNoGen); NO_COPY_SEMANTIC(ObjectAllocatorNoGen); diff --git a/runtime/include/thread.h b/runtime/include/thread.h index ad45103..995ab6f 100644 --- a/runtime/include/thread.h +++ b/runtime/include/thread.h @@ -34,7 +34,6 @@ #include "runtime/include/stack_walker.h" #include "runtime/include/language_context.h" #include "runtime/include/locks.h" -#include "runtime/include/language_context.h" #include "runtime/include/thread_status.h" #include "runtime/interpreter/cache.h" #include "runtime/interpreter/frame.h" diff --git a/runtime/include/vtable_builder-inl.h b/runtime/include/vtable_builder-inl.h index 920109b..c7c6a24 100644 --- a/runtime/include/vtable_builder-inl.h +++ b/runtime/include/vtable_builder-inl.h @@ -50,7 +50,7 @@ void VTableBuilderImpl::BuildForInterface(Span< } ++num_vmethods_; - }; + } } template diff --git a/runtime/interpreter/interpreter-inl.h b/runtime/interpreter/interpreter-inl.h index 09b8c94..5ac5170 100644 --- a/runtime/interpreter/interpreter-inl.h +++ b/runtime/interpreter/interpreter-inl.h @@ -2383,7 +2383,7 @@ public: default: UNREACHABLE(); break; - }; + } } template @@ -2431,7 +2431,7 @@ public: default: UNREACHABLE(); break; - }; + } } template @@ -2483,7 +2483,7 @@ public: UNREACHABLE(); break; } - }; + } } template @@ -2535,7 +2535,7 @@ public: UNREACHABLE(); break; } - }; + } } template @@ -2753,7 +2753,7 @@ public: break; default: UNREACHABLE(); - }; + } } template @@ -2797,7 +2797,7 @@ public: break; default: UNREACHABLE(); - }; + } } template diff --git a/runtime/mem/gc/gc.cpp b/runtime/mem/gc/gc.cpp index c1920af..9450a4d 100644 --- a/runtime/mem/gc/gc.cpp +++ b/runtime/mem/gc/gc.cpp @@ -36,7 +36,6 @@ #include "runtime/mem/heap_manager.h" #include "runtime/mem/gc/reference-processor/reference_processor.h" #include "runtime/include/panda_vm.h" -#include "runtime/assert_gc_scope.h" #include "runtime/include/object_accessor-inl.h" #include "runtime/include/coretypes/class.h" #include "runtime/thread_manager.h" diff --git a/runtime/mem/gc/gen-gc/gen-gc.cpp b/runtime/mem/gc/gen-gc/gen-gc.cpp index cb4fae8..a00e7a8 100644 --- a/runtime/mem/gc/gen-gc/gen-gc.cpp +++ b/runtime/mem/gc/gen-gc/gen-gc.cpp @@ -24,7 +24,6 @@ #include "runtime/mem/refstorage/global_object_storage.h" #include "runtime/mem/rendezvous.h" #include "runtime/include/panda_vm.h" -#include "runtime/include/hclass.h" #include "runtime/mem/gc/card_table-inl.h" #include "runtime/timing.h" #include "runtime/include/exceptions.h" diff --git a/runtime/mem/gc/generational-gc-base.h b/runtime/mem/gc/generational-gc-base.h index afc9827..eb57b01 100644 --- a/runtime/mem/gc/generational-gc-base.h +++ b/runtime/mem/gc/generational-gc-base.h @@ -27,6 +27,7 @@ namespace panda::mem { template class GenerationalGC : public GCLang { public: + protected: GenerationalGC(ObjectAllocatorBase *object_allocator, const GCSettings &settings) : GCLang(object_allocator, settings) diff --git a/runtime/mem/memory_manager.cpp b/runtime/mem/memory_manager.cpp index d0f87c9..8c03cde 100644 --- a/runtime/mem/memory_manager.cpp +++ b/runtime/mem/memory_manager.cpp @@ -53,10 +53,6 @@ MemoryManager *MemoryManager::Create(LanguageContext ctx, InternalAllocatorPtr i const HeapOptions &heap_options) { std::unique_ptr mem_stats = std::make_unique(); - if (mem_stats == nullptr) { - LOG(ERROR, RUNTIME) << "Failed to allocate MemStatsType"; - return nullptr; - } HeapManager *heap_manager = CreateHeapManager(internal_allocator, heap_options, gc_type, mem_stats.get()); if (heap_manager == nullptr) { diff --git a/runtime/string_table.h b/runtime/string_table.h index 76f3d6d..65150d8 100644 --- a/runtime/string_table.h +++ b/runtime/string_table.h @@ -91,6 +91,7 @@ protected: // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) PandaUnorderedMultiMap table_ GUARDED_BY(table_lock_) {}; os::memory::RWLock table_lock_; // NOLINT(misc-non-private-member-variables-in-classes) + private: NO_COPY_SEMANTIC(Table); NO_MOVE_SEMANTIC(Table); diff --git a/runtime/tests/multithreaded_intern_string_table_test.cpp b/runtime/tests/multithreaded_intern_string_table_test.cpp index 5cde4d1..8e63ea4 100644 --- a/runtime/tests/multithreaded_intern_string_table_test.cpp +++ b/runtime/tests/multithreaded_intern_string_table_test.cpp @@ -91,7 +91,7 @@ public: { // Loop until lock is taken while (lock_.test_and_set(std::memory_order_seq_cst)) { - }; + } if (string_ != nullptr) { ASSERT_EQ(string_, string); } else { diff --git a/runtime/tooling/debugger.h b/runtime/tooling/debugger.h index 021c165..d9d06fc 100644 --- a/runtime/tooling/debugger.h +++ b/runtime/tooling/debugger.h @@ -35,7 +35,6 @@ #include "runtime/include/panda_vm.h" #include "runtime/include/tooling/debug_interface.h" #include "runtime/thread_manager.h" -#include "pt_hooks_wrapper.h" namespace panda::tooling { // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) diff --git a/verification/absint/abs_int_inl.h b/verification/absint/abs_int_inl.h index aef6ac9..9c341e3 100644 --- a/verification/absint/abs_int_inl.h +++ b/verification/absint/abs_int_inl.h @@ -3930,7 +3930,7 @@ private: END_SHOW_MSG(); SET_STATUS_FOR_MSG(BadAccumulatorType); return false; - }; + } MoveToNextInst(); return true; diff --git a/verification/absint/reg_context.h b/verification/absint/reg_context.h index 3fa053b..868e1a9 100644 --- a/verification/absint/reg_context.h +++ b/verification/absint/reg_context.h @@ -208,7 +208,7 @@ public: result += abs_type_val.template Image(img); if (comma) { log_string += ", "; - }; + } log_string += result; comma = true; return true; diff --git a/verification/debug/context/context.h b/verification/debug/context/context.h index 20348d1..381da1c 100644 --- a/verification/debug/context/context.h +++ b/verification/debug/context/context.h @@ -19,7 +19,6 @@ #include "verification/debug/breakpoint/breakpoint_private.h" #include "verification/debug/allowlist/allowlist_private.h" #include "verification/debug/config/config.h" -#include "verification/debug/config/config.h" #include "verification/util/callable.h" #include "verification/util/synchronized.h" diff --git a/verification/debug/options/method_options.h b/verification/debug/options/method_options.h index fb6de03..faceecb 100644 --- a/verification/debug/options/method_options.h +++ b/verification/debug/options/method_options.h @@ -244,7 +244,7 @@ public: default: result += ""; break; - }; + } return true; }); result += "\n"; @@ -263,7 +263,7 @@ public: default: result += ""; break; - }; + } return true; }); @@ -319,7 +319,7 @@ private: default: result += ""; break; - }; + } return true; }); result += "\n"; diff --git a/verification/type/type_parametric.cpp b/verification/type/type_parametric.cpp index 8456944..6cbca0e 100644 --- a/verification/type/type_parametric.cpp +++ b/verification/type/type_parametric.cpp @@ -56,7 +56,7 @@ void ParametricType::ForAll(Handler &&handler) const GetTypeSystem().ForAllTypes([this, &handler](const Type &type) { if (type.Sort() == Sort_) { return handler(type); - }; + } return true; }); } diff --git a/verification/type/type_parametric_inl.h b/verification/type/type_parametric_inl.h index 8cb109b..1ea1c14 100644 --- a/verification/type/type_parametric_inl.h +++ b/verification/type/type_parametric_inl.h @@ -26,7 +26,7 @@ void ForAll(Handler &&handler) const GetTypeSystem().ForAllTypes([this, &handler](const Type &type) { if (type.Sort() == Sort_) { return handler(type); - }; + } return true; }); } diff --git a/verification/type/type_system.h b/verification/type/type_system.h index ae1d228..57c3353 100644 --- a/verification/type/type_system.h +++ b/verification/type/type_system.h @@ -199,17 +199,17 @@ public: case TypeVariance::INVARIANT: if (!TypingRel_.IsInIsoRelation(*lhs_it, *rhs_it)) { return false; - }; + } break; case TypeVariance::COVARIANT: if (!TypingRel_.IsInDirectRelation(*lhs_it, *rhs_it)) { return false; - }; + } break; case TypeVariance::CONTRVARIANT: if (!TypingRel_.IsInInverseRelation(*lhs_it, *rhs_it)) { return false; - }; + } break; default: break; diff --git a/verification/util/bit_vector.h b/verification/util/bit_vector.h index dfa288f..3d8389a 100644 --- a/verification/util/bit_vector.h +++ b/verification/util/bit_vector.h @@ -267,19 +267,19 @@ public: { for (size_t pos = 0; pos < size_in_words(); ++pos) { data_[pos] = 0; - }; + } } void set() { for (size_t pos = 0; pos < size_in_words(); ++pos) { data_[pos] = MAX_WORD; - }; + } } void invert() { for (size_t pos = 0; pos < size_in_words(); ++pos) { data_[pos] = ~data_[pos]; - }; + } } void Clr(size_t idx) { diff --git a/verification/util/flags.h b/verification/util/flags.h index f027724..3258944 100644 --- a/verification/util/flags.h +++ b/verification/util/flags.h @@ -91,6 +91,7 @@ public: return {mask, flags_}; } #endif + protected: constexpr static UInt mask = static_cast(1); UInt flags_ {0}; diff --git a/verification/value/variables.h b/verification/value/variables.h index 5609d18..86fd066 100644 --- a/verification/value/variables.h +++ b/verification/value/variables.h @@ -74,7 +74,7 @@ public: using VarIdx = size_t; Variables() = default; - Variables(TypeSystemKind) {}; + Variables(TypeSystemKind) {} Variables(const Variables &) = default; Variables(Variables &&) = default; Variables &operator=(const Variables &) = default;