!111 Codehub issues fix

Merge pull request !111 from trubachevilya/codehub_issues_fix
This commit is contained in:
openharmony_ci
2022-03-23 12:28:43 +00:00
committed by Gitee
38 changed files with 52 additions and 69 deletions
-11
View File
@@ -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");
-1
View File
@@ -15,7 +15,6 @@
#include "assembly-emitter.h"
#include <cctype>
#include <algorithm>
#include <cctype>
#include <iostream>
+1 -1
View File
@@ -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<char *>(const_cast<uint8_t *>(sd.data)));
return res;
}
+4 -4
View File
@@ -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<void *>(addr))
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define TSAN_ANNOTATE_HAPPENS_AFTER(addr) \
AnnotateHappensAfter(__FILE__, __LINE__, (void*)(addr))
AnnotateHappensAfter(__FILE__, __LINE__, reinterpret_cast<void *>(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<void *>(addr))
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define TSAN_ANNOTATE_HAPPENS_AFTER(addr) \
AnnotateHappensAfter(__FILE__, __LINE__, (void*)(addr))
AnnotateHappensAfter(__FILE__, __LINE__, reinterpret_cast<void *>(addr))
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define TSAN_ANNOTATE_IGNORE_WRITES_BEGIN() \
+3 -3
View File
@@ -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);
+1 -2
View File
@@ -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 <securec.h>
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -172,7 +172,7 @@ public:
#undef D
default:
break;
};
}
UNREACHABLE();
return 0;
+8 -4
View File
@@ -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 <typename T,
class PandArg : public PandArgBase {
public:
explicit PandArg(const std::string &name, T default_val, const std::string &desc)
: PandArgBase(name, desc, this->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);
+1 -1
View File
@@ -56,7 +56,7 @@ __extension__ using int128 = __int128;
#include <cstdint>
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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -115,7 +115,7 @@ public:
virtual size_t CalculateSize() const = 0;
virtual void ComputeLayout() {};
virtual void ComputeLayout() {}
virtual size_t Alignment()
{
@@ -31,7 +31,6 @@
#include <climits>
#include <cstdlib>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/stat.h>
+1 -1
View File
@@ -50,7 +50,7 @@ void CoreClassLinkerExtension::ErrorHandler::OnError(ClassLinker::Error error, c
default:
LOG(FATAL, CLASS_LINKER) << "Unhandled error (" << static_cast<size_t>(error) << "): " << message;
break;
};
}
}
// CODECHECK-NOLINTNEXTLINE(C_RULE_ID_FUNCTION_SIZE)
+1 -2
View File
@@ -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 {
+1 -1
View File
@@ -68,7 +68,7 @@ Class *Field::ResolveTypeClass(ClassLinkerErrorHandler *error_handler) const
error_handler);
default:
UNREACHABLE();
};
}
}
} // namespace panda
-1
View File
@@ -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 {
+1
View File
@@ -569,6 +569,7 @@ class ObjectAllocatorNoGen final : public ObjectAllocatorBase {
using ObjectAllocator = RunSlotsAllocator<ObjectAllocConfig>; // Allocator used for middle size allocations
using LargeObjectAllocator = FreeListAllocator<ObjectAllocConfig>; // Allocator used for large objects
using HumongousObjectAllocator = HumongousObjAllocator<ObjectAllocConfig>; // Allocator used for humongous objects
public:
NO_MOVE_SEMANTIC(ObjectAllocatorNoGen);
NO_COPY_SEMANTIC(ObjectAllocatorNoGen);
-1
View File
@@ -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"
+1 -1
View File
@@ -50,7 +50,7 @@ void VTableBuilderImpl<SearchBySignature, OverridePred>::BuildForInterface(Span<
}
++num_vmethods_;
};
}
}
template <class SearchBySignature, class OverridePred>
+6 -6
View File
@@ -2383,7 +2383,7 @@ public:
default:
UNREACHABLE();
break;
};
}
}
template <class F, class T>
@@ -2431,7 +2431,7 @@ public:
default:
UNREACHABLE();
break;
};
}
}
template <class T, class R>
@@ -2483,7 +2483,7 @@ public:
UNREACHABLE();
break;
}
};
}
}
template <class T>
@@ -2535,7 +2535,7 @@ public:
UNREACHABLE();
break;
}
};
}
}
template <BytecodeInstruction::Format format, class T>
@@ -2753,7 +2753,7 @@ public:
break;
default:
UNREACHABLE();
};
}
}
template <BytecodeInstruction::Format format>
@@ -2797,7 +2797,7 @@ public:
break;
default:
UNREACHABLE();
};
}
}
template <BytecodeInstruction::Format format>
-1
View File
@@ -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"
-1
View File
@@ -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"
+1
View File
@@ -27,6 +27,7 @@ namespace panda::mem {
template <class LanguageConfig>
class GenerationalGC : public GCLang<LanguageConfig> {
public:
protected:
GenerationalGC(ObjectAllocatorBase *object_allocator, const GCSettings &settings)
: GCLang<LanguageConfig>(object_allocator, settings)
-4
View File
@@ -53,10 +53,6 @@ MemoryManager *MemoryManager::Create(LanguageContext ctx, InternalAllocatorPtr i
const HeapOptions &heap_options)
{
std::unique_ptr<MemStatsType> mem_stats = std::make_unique<MemStatsType>();
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) {
+1
View File
@@ -91,6 +91,7 @@ protected:
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes)
PandaUnorderedMultiMap<uint32_t, coretypes::String *> 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);
@@ -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 {
-1
View File
@@ -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)
+1 -1
View File
@@ -3930,7 +3930,7 @@ private:
END_SHOW_MSG();
SET_STATUS_FOR_MSG(BadAccumulatorType);
return false;
};
}
MoveToNextInst<format>();
return true;
+1 -1
View File
@@ -208,7 +208,7 @@ public:
result += abs_type_val.template Image<PandaString>(img);
if (comma) {
log_string += ", ";
};
}
log_string += result;
comma = true;
return true;
-1
View File
@@ -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"
+3 -3
View File
@@ -244,7 +244,7 @@ public:
default:
result += "<unknown>";
break;
};
}
return true;
});
result += "\n";
@@ -263,7 +263,7 @@ public:
default:
result += "<unknown>";
break;
};
}
return true;
});
@@ -319,7 +319,7 @@ private:
default:
result += "<unknown>";
break;
};
}
return true;
});
result += "\n";
+1 -1
View File
@@ -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;
});
}
+1 -1
View File
@@ -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;
});
}
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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)
{
+1
View File
@@ -91,6 +91,7 @@ public:
return {mask, flags_};
}
#endif
protected:
constexpr static UInt mask = static_cast<UInt>(1);
UInt flags_ {0};
+1 -1
View File
@@ -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;