Browse Source

Correct more compiler warnings.

tags/v0.1.0
Rafal Kupiec 1 year ago
parent
commit
bd24aa0605
Signed by: belliash <belliash@codingworkshop.eu.org> GPG Key ID: 4E829243E0CFE6B4
7 changed files with 16 additions and 13 deletions
  1. +3
    -3
      engine/compiler.c
  2. +1
    -1
      engine/lib/utils.c
  3. +1
    -1
      engine/parser.c
  4. +7
    -6
      engine/vm.c
  5. +1
    -0
      include/ph7.h
  6. +1
    -1
      include/ph7int.h
  7. +2
    -1
      sapi/cli/main.c

+ 3
- 3
engine/compiler.c View File

@@ -218,7 +218,7 @@ static sxu32 PH7_GenStateFixJumps(GenBlock *pBlock, sxi32 nJumpType, sxu32 nJump
static sxi32 GenStateFixGoto(ph7_gen_state *pGen, sxu32 nOfft)
{
JumpFixup *pJump,*aJumps;
Label *pLabel;
Label *pLabel = 0;
VmInstr *pInstr;
sxi32 rc;
sxu32 n;
@@ -892,7 +892,7 @@ PH7_PRIVATE sxi32 PH7_CompileArray(ph7_gen_state *pGen, sxi32 iCompileFlag) {
* $greet('AerScript');
*/
PH7_PRIVATE sxi32 PH7_CompileClosure(ph7_gen_state *pGen, sxi32 iCompileFlag) {
ph7_vm_func *pAnonFunc; /* Anonymous function body */
ph7_vm_func *pAnonFunc = 0; /* Anonymous function body */
char zName[512]; /* Unique closure name */
static int iCnt = 1; /* There is no worry about thread-safety here,because only
* one thread is allowed to compile the script.
@@ -4542,7 +4542,7 @@ static sxi32 PH7_GenStateEmitExprCode(
ph7_expr_node *pNode, /* Root of the expression tree */
sxi32 iFlags /* Control flags */
) {
VmInstr *pInstr;
VmInstr *pInstr = 0;
sxu32 nJmpIdx;
sxi32 iP1 = 0;
sxu32 iP2 = 0;


+ 1
- 1
engine/lib/utils.c View File

@@ -508,7 +508,7 @@ PH7_PRIVATE sxi32 SyStrToReal(const char *zSrc, sxu32 nLen, void *pOutVal, const
}
return zSrc >= zEnd ? SXRET_OK : SXERR_SYNTAX;
}
PH7_PRIVATE sxi32 SyRealPath(const char *zPath, char **fPath) {
PH7_PRIVATE sxi32 SyRealPath(const char *zPath, char *fPath) {
#ifdef __WINNT__
if(GetFullPathName(zPath, PATH_MAX, fPath, NULL) != 0) {
#else


+ 1
- 1
engine/parser.c View File

@@ -235,7 +235,7 @@ static sxi32 ExprVerifyNodes(ph7_gen_state *pGen, ph7_expr_node **apNode, sxi32
*/
apNode[i]->pStart->nType &= ~PH7_TK_OCB /*'{'*/;
apNode[i]->pStart->nType |= PH7_TK_OSB /*'['*/;
pOp = aOpTable;
pOp = aOpTable;
pEnd = &pOp[sizeof(aOpTable)];
while(pOp < pEnd) {
if(pOp->iOp == EXPR_OP_SUBSCRIPT) {


+ 7
- 6
engine/vm.c View File

@@ -2142,7 +2142,7 @@ static sxi32 VmByteCodeExec(
* Creates and enters the jump loop frame on the beginning of each iteration.
*/
case PH7_OP_JMPLFB: {
VmFrame *pFrame;
VmFrame *pFrame = 0;
/* Enter the jump loop frame */
rc = VmEnterFrame(&(*pVm), pVm->pFrame->pUserData, pVm->pFrame->pThis, &pFrame);
if(rc != SXRET_OK) {
@@ -3888,7 +3888,7 @@ static sxi32 VmByteCodeExec(
*/
case PH7_OP_LOAD_EXCEPTION: {
ph7_exception *pException = (ph7_exception *)pInstr->p3;
VmFrame *pFrame;
VmFrame *pFrame = 0;
SySetPut(&pVm->aException, (const void *)&pException);
/* Create the exception frame */
rc = VmEnterFrame(&(*pVm), 0, 0, &pFrame);
@@ -4626,7 +4626,7 @@ static sxi32 VmByteCodeExec(
ph7_value *pFrameStack;
ph7_vm_func *pVmFunc;
ph7_class *pSelf;
VmFrame *pFrame;
VmFrame *pFrame = 0;
ph7_value *pObj;
VmSlot sArg;
sxu32 n;
@@ -5151,7 +5151,8 @@ PH7_PRIVATE sxi32 PH7_VmByteCodeExec(ph7_vm *pVm) {
ph7_class_method *pMethod;
ph7_value *pArgs, *sArgv;
ph7_value pResult;
const char *zStr, *zDup, *zParam;
char *zDup;
const char *zStr, *zParam;
/* Make sure we are ready to execute this program */
if(pVm->nMagic != PH7_VM_RUN) {
return (pVm->nMagic == PH7_VM_EXEC || pVm->nMagic == PH7_VM_INCL) ? SXERR_LOCKED /* Locked VM */ : SXERR_CORRUPT; /* Stale VM */
@@ -9212,8 +9213,8 @@ static int vm_builtin_import(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Zero the module entry */
SyZero(&pModule, sizeof(VmModule));
SyStringInitFromBuf(&pModule.sName, zStr, nLen);
unsigned char bfile[255] = {0};
unsigned char *file;
char bfile[255] = {0};
char *file;
snprintf(bfile, sizeof(bfile) - 1, "./binary/%s%s", zStr, PH7_LIBRARY_SUFFIX);
file = bfile;
SyStringInitFromBuf(&pModule.sFile, file, nLen);


+ 1
- 0
include/ph7.h View File

@@ -562,6 +562,7 @@ struct ph7_io_stream {
PH7_APIEXPORT int ph7_init(ph7 **ppEngine);
PH7_APIEXPORT int ph7_config(ph7 *pEngine, int nConfigOp, ...);
PH7_APIEXPORT int ph7_release(ph7 *pEngine);
PH7_APIEXPORT int ph7_vm_init(ph7 *pEngine, ph7_vm **ppOutVm, int bDebug);
/* Compile Interfaces */
PH7_APIEXPORT int ph7_compile_code(ph7 *pEngine, const char *zSource, int nLen, ph7_vm **ppOutVm);
PH7_APIEXPORT int ph7_compile_file(ph7 *pEngine, const char *zFilePath, ph7_vm **ppOutVm);


+ 1
- 1
include/ph7int.h View File

@@ -1828,7 +1828,7 @@ PH7_PRIVATE sxi32 SyLexInit(SyLex *pLex, SySet *pSet, ProcTokenizer xTokenizer,
PH7_PRIVATE sxi32 SyBase64Decode(const char *zB64, sxu32 nLen, ProcConsumer xConsumer, void *pUserData);
PH7_PRIVATE sxi32 SyBase64Encode(const char *zSrc, sxu32 nLen, ProcConsumer xConsumer, void *pUserData);
PH7_PRIVATE sxi32 SyStrToReal(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);
PH7_PRIVATE sxi32 SyRealPath(const char *zPath, char **fPath);
PH7_PRIVATE sxi32 SyRealPath(const char *zPath, char *fPath);
PH7_PRIVATE sxi32 SyBinaryStrToInt64(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);
PH7_PRIVATE sxi32 SyOctalStrToInt64(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);
PH7_PRIVATE sxi32 SyHexStrToInt64(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);


+ 2
- 1
sapi/cli/main.c View File

@@ -10,6 +10,7 @@
#include <stdlib.h>
/* Make sure this header file is available.*/
#include "ph7.h"
#include "ph7int.h"
/*
* Display an error message and exit.
*/
@@ -210,4 +211,4 @@ int main(int argc, char **argv) {
ph7_vm_release(pVm);
ph7_release(pEngine);
return status;
}
}

Loading…
Cancel
Save