From d1a7d32e7bc27145f69077081143bd6832dd9ee9 Mon Sep 17 00:00:00 2001 From: ValKmjolnir Date: Mon, 11 Jul 2022 23:53:23 +0800 Subject: [PATCH] :memo: fix some wanings. --- nasal_builtin.h | 4 +++- nasal_dbg.h | 2 +- nasal_gc.h | 11 ++--------- nasal_vm.h | 8 +++++--- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/nasal_builtin.h b/nasal_builtin.h index 306119d..785d63e 100644 --- a/nasal_builtin.h +++ b/nasal_builtin.h @@ -1367,7 +1367,9 @@ nasal_ref builtin_corun(nasal_ref* local,nasal_gc& gc) } nasal_ref builtin_millisec(nasal_ref* local,nasal_gc& gc) { - double res=std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count(); + double res=std::chrono::duration_cast + (std::chrono::high_resolution_clock::now().time_since_epoch()) + .count(); return {vm_num,res}; } nasal_ref builtin_sysargv(nasal_ref* local,nasal_gc& gc) diff --git a/nasal_dbg.h b/nasal_dbg.h index 7c10c7d..cc0777d 100644 --- a/nasal_dbg.h +++ b/nasal_dbg.h @@ -20,7 +20,7 @@ private: void interact(); public: nasal_dbg(): - next_step(false), + next_step(false),fsize(0), bk_fidx(0),bk_line(0){} void run( const nasal_codegen&, diff --git a/nasal_gc.h b/nasal_gc.h index df308d0..151c9b4 100644 --- a/nasal_gc.h +++ b/nasal_gc.h @@ -477,15 +477,8 @@ struct nasal_gc nasal_ref*& _canary, nasal_ref*& _top, nasal_ref* _stk): - pc(_pc), - localr(_localr), - memr(_memr), - funcr(_funcr), - upvalr(_upvalr), - canary(_canary), - top(_top), - stack(_stk), - temp(nil){} + pc(_pc),localr(_localr),memr(_memr),funcr(_funcr),upvalr(_upvalr), + canary(_canary),top(_top),stack(_stk),coroutine(nullptr),temp(nil){} void mark(); void sweep(); void init(const std::vector&,const std::vector&); diff --git a/nasal_vm.h b/nasal_vm.h index 9c94968..8816066 100644 --- a/nasal_vm.h +++ b/nasal_vm.h @@ -125,7 +125,8 @@ public: nasal_vm():pc(0),localr(nullptr),memr(nullptr),funcr(nil), upvalr(nil),canary(nullptr),top(stack), num_table(nullptr),str_table(nullptr), - gc(pc,localr,memr,funcr,upvalr,canary,top,stack){} + gc(pc,localr,memr,funcr,upvalr,canary,top,stack), + files(nullptr),bytecode(nullptr),detail_info(false){} void run( const nasal_codegen&, const nasal_import&, @@ -785,11 +786,12 @@ inline void nasal_vm::opr_callfh() } inline void nasal_vm::opr_callb() { - // reserve place for builtin function return, in fact this code is changed because of coroutine + // reserve place for builtin function return, + // in fact this code is changed because of coroutine (++top)[0]=nil; // this ++top should not be used like: (++top)[0] here // because if running a builtin function about coroutine - // this (top) will be set to another context.top, instead of main_context.top + // (top) will be set to another context.top, instead of main_context.top top[0]=(*builtin[imm[pc]].func)(localr,gc); if(top[0].type==vm_none) die("native function error.");