fix general warning

Signed-off-by: hanweiqi <hanweiqi3@huawei.com>
This commit is contained in:
hanweiqi 2024-06-05 19:31:08 +08:00
parent b4d624d93b
commit 4bd3a62b02
10 changed files with 42 additions and 33 deletions

View File

@ -38,7 +38,7 @@ template <typename IntType> static void ByteSwap(IntType& x)
static constexpr unsigned int iByteMuskOff1 = iByteMuskOff0 << 8;
static constexpr unsigned int iByteMuskOff2 = iByteMuskOff1 << 8;
static constexpr unsigned int iByteMuskOff3 = iByteMuskOff2 << 8;
static constexpr unsigned long long llByteMuskOff0 = 0xffull;
static constexpr unsigned long long llByteMuskOff0 = 0xffuLL;
static constexpr unsigned long long llByteMuskOff1 = llByteMuskOff0 << 8;
static constexpr unsigned long long llByteMuskOff2 = llByteMuskOff1 << 8;
static constexpr unsigned long long llByteMuskOff3 = llByteMuskOff2 << 8;

View File

@ -25,8 +25,8 @@ namespace namemangler {
#define DEBUG_ASSERT(f) ((void)0)
#endif
const int kLocalCodebufSize = 1024;
const int kMaxCodecbufSize = (1 << 16);
const int KLOCAL_CODE_BUF_SIZE = 1024;
const int KMAX_CODEC_BUF_SIZE = (1 << 16);
#define GETHEXCHAR(n) static_cast<char>((n) < 10 ? (n) + '0' : (n)-10 + 'a')
#define GETHEXCHARU(n) static_cast<char>((n) < 10 ? (n) + '0' : (n)-10 + 'A')
@ -41,7 +41,8 @@ static inline char *AllocCodecBuf(size_t maxLen)
}
// each char may have 2 more char, so give out the max space buffer
constexpr int multi = 3;
return reinterpret_cast<char *>(malloc((maxLen <= kLocalCodebufSize) ? multi * maxLen : multi * kMaxCodecbufSize));
return reinterpret_cast<char *>(
malloc((maxLen <= KLOCAL_CODE_BUF_SIZE) ? multi * maxLen : multi * KMAX_CODEC_BUF_SIZE));
}
static inline void FreeCodecBuf(char *buf)
@ -53,7 +54,7 @@ std::string EncodeName(const std::string &name)
{
// name is guaranteed to be null-terminated
size_t nameLen = name.length();
nameLen = nameLen > kMaxCodecbufSize ? kMaxCodecbufSize : nameLen;
nameLen = nameLen > KMAX_CODEC_BUF_SIZE ? KMAX_CODEC_BUF_SIZE : nameLen;
char *buf = AllocCodecBuf(nameLen);
if (buf == nullptr) {
return std::string(name);

View File

@ -819,8 +819,7 @@ JSTaggedValue JSDate::ValueOf() const
void JSDate::GetDateValues(double timeMs, std::array<int64_t, DATE_LENGTH> *date, bool isLocal)
{
int64_t tz = 0;
int64_t timeMsInt;
timeMsInt = static_cast<int64_t>(timeMs);
int64_t timeMsInt = static_cast<int64_t>(timeMs);
if (isLocal) { // timezone offset
tz = GetLocalOffsetFromOS(timeMsInt, isLocal);
timeMsInt += tz * MS_PER_SECOND * SEC_PER_MINUTE;

View File

@ -299,7 +299,7 @@ public:
static bool IsThirdDigitAlphanum(const std::string &value)
{
return InRange(value[0], '0', '9') && value.length() == 4 &&
return InRange(value[0], '0', '9') && value.length() == INTL_INDEX_FOUR &&
IsAlphanum(value.substr(INTL_INDEX_ONE), INTL_INDEX_THREE, INTL_INDEX_THREE);
}
@ -407,7 +407,7 @@ public:
static bool IsWellAlphaNumList(const std::string &value)
{
if (value.length() < 3) {
if (value.length() < INTL_INDEX_THREE) {
return false;
}
char lastChar = value[value.length() - 1];

View File

@ -70,7 +70,7 @@ PropertyAttributes::PropertyAttributes(const PropertyDescriptor &desc)
void ThroughputJSObjectResizingStrategy::UpdateGrowStep(JSThread *thread, uint32_t step)
{
// 2 : double
// 2 : multiple double
thread->SetPropertiesGrowStep(std::min(static_cast<uint32_t>(JSObjectResizingStrategy::PROPERTIES_GROW_SIZE * 2),
step));
}

View File

@ -428,7 +428,7 @@ void SharedHeap::EnableParallelGC(JSRuntimeOptions &option)
if (auto workThreadNum = sWorkManager_->GetTotalThreadNum();
workThreadNum != totalThreadNum + 1) {
LOG_ECMA_MEM(ERROR) << "TheadNum mismatch, totalThreadNum(sWorkerManager): " << workThreadNum << ", "
<< "totalThreadNum(taskpool): " << totalThreadNum + 1;
<< "totalThreadNum(taskpool): " << (totalThreadNum + 1);
delete sWorkManager_;
sWorkManager_ = new SharedGCWorkManager(this, totalThreadNum + 1);
UpdateWorkManager(sWorkManager_);

View File

@ -44,7 +44,6 @@
#include "uv.h"
#endif
sem_t g_heapdumpCnt;
namespace panda {
using ecmascript::CString;
@ -61,6 +60,7 @@ using ecmascript::FileStream;
using ecmascript::FileDescriptorStream;
using ecmascript::CMap;
using ecmascript::Tracing;
sem_t g_heapdumpCnt;
void DFXJSNApi::DumpHeapSnapshot([[maybe_unused]] const EcmaVM *vm, [[maybe_unused]] int dumpFormat,
[[maybe_unused]] const std::string &path, [[maybe_unused]] bool isVmMode,

View File

@ -1749,29 +1749,38 @@ declare class DataView extends Object {
}
declare class Atomics extends Object {
add(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
add(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number,
value: number): number;
and(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
and(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number,
value: number): number;
compareExchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, expectedValue: number, replacementValue: number): number;
compareExchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array,
index: number, expectedValue: number, replacementValue: number): number;
exchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
exchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number,
value: number): number;
isLockFree(size: number): boolean;
load(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number): number;
load(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array,
index: number): number;
or(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
or(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number,
value: number): number;
store(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
store(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number,
value: number): number;
sub(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
sub(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number,
value: number): number;
wait(typedArray: Int32Array, index: number, value: number, timeout?: number): 'ok' | 'not-equal' | 'timed-out';
notify(typedArray: Int32Array, index: number, count?: number): number;
xor(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
xor(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number,
value: number): number;
//1.[Symbol.toStringTag]: "Atomics";
}

View File

@ -37,10 +37,10 @@ export class XTools {
try {
XTools.CONFIG = JSON.parse(xhr.responseText);
for (let k in XTools.CONFIG.NodeColor) {
XTools.CONFIG.NodeColor[k] = parseInt(XTools.CONFIG.NodeColor[k],16);
XTools.CONFIG.NodeColor[k] = parseInt(XTools.CONFIG.NodeColor[k], 16);
}
for (let k in XTools.CONFIG.LineColor) {
XTools.CONFIG.LineColor[k] = parseInt(XTools.CONFIG.LineColor[k],16);
XTools.CONFIG.LineColor[k] = parseInt(XTools.CONFIG.LineColor[k], 16);
}
} catch (e) {
alert('Config file error');

View File

@ -25,7 +25,7 @@ const INTYPE = {
other: 5,
};
class NODE_TYPE_MASK {
class NodeTypeMask {
static NONE = 0;
static CONTROL = 1 << INTYPE.state;
static DEPEND = 1 << INTYPE.depend;
@ -55,27 +55,27 @@ class IrToPicture {
return 'other';
}
static nodeTypeMask(ir) {
let mask = NODE_TYPE_MASK.NONE;
let mask = NodeTypeMask.NONE;
if (XTools.CONFIG.OpTypeControl.indexOf(ir.op) >= 0) {
mask |= NODE_TYPE_MASK.CONTROL;
mask |= NodeTypeMask.CONTROL;
}
if (ir.in[INTYPE.state].length > 0 && XTools.CONFIG.OpNotControl.indexOf(ir.op) === -1) {
mask |= NODE_TYPE_MASK.CONTROL;
mask |= NodeTypeMask.CONTROL;
}
if (XTools.CONFIG.OpTypeDepend.indexOf(ir.op) >= 0 || ir.in[INTYPE.depend].length > 0) {
mask |= NODE_TYPE_MASK.DEPEND;
mask |= NodeTypeMask.DEPEND;
}
if (XTools.CONFIG.OpTypeValue.indexOf(ir.op) >= 0 || ir.in[INTYPE.value].length > 0) {
mask |= NODE_TYPE_MASK.VALUE;
mask |= NodeTypeMask.VALUE;
}
if (XTools.CONFIG.OpTypeFrameState.indexOf(ir.op) >= 0 || ir.in[INTYPE.framestate].length > 0) {
mask |= NODE_TYPE_MASK.FRAMESTATE;
mask |= NodeTypeMask.FRAMESTATE;
}
if (XTools.CONFIG.OpTypeCircuitRoot.indexOf(ir.op) >= 0 || ir.in[INTYPE.root].length > 0) {
mask |= NODE_TYPE_MASK.ROOT;
mask |= NodeTypeMask.ROOT;
}
if (mask === NODE_TYPE_MASK.NONE) {
mask = NODE_TYPE_MASK.OTHER;
if (mask === NodeTypeMask.NONE) {
mask = NodeTypeMask.OTHER;
}
return mask;
}