mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 19:19:53 +00:00
Fix compiler warnings with GCC.
This commit is contained in:
parent
b6d90ed765
commit
278769f2bb
@ -91,7 +91,7 @@ static void replonvalue(DstContext *c, Dst value) {
|
|||||||
|
|
||||||
/* Handle errors on repl */
|
/* Handle errors on repl */
|
||||||
static void simpleerror(DstContext *c, enum DstContextErrorType type, Dst err, size_t start, size_t end) {
|
static void simpleerror(DstContext *c, enum DstContextErrorType type, Dst err, size_t start, size_t end) {
|
||||||
const char *errtype;
|
const char *errtype = "";
|
||||||
(void) c;
|
(void) c;
|
||||||
(void) start;
|
(void) start;
|
||||||
(void) end;
|
(void) end;
|
||||||
|
@ -353,6 +353,8 @@ DstSlot dstc_while(DstFopts opts, DstAst *ast, int32_t argn, const Dst *argv) {
|
|||||||
labelc = dst_v_count(c->buffer);
|
labelc = dst_v_count(c->buffer);
|
||||||
dstc_emit(c, ast, DOP_JUMP_IF_NOT | (condlocal << 8));
|
dstc_emit(c, ast, DOP_JUMP_IF_NOT | (condlocal << 8));
|
||||||
dstc_postread(c, cond, condlocal);
|
dstc_postread(c, cond, condlocal);
|
||||||
|
} else {
|
||||||
|
labelc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compile body */
|
/* Compile body */
|
||||||
|
@ -173,7 +173,7 @@ int dst_core_get(DstArgs args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int dst_core_status(DstArgs args) {
|
int dst_core_status(DstArgs args) {
|
||||||
const char *status;
|
const char *status = "";
|
||||||
if (args.n != 1) return dst_throw(args, "expected 1 argument");
|
if (args.n != 1) return dst_throw(args, "expected 1 argument");
|
||||||
if (!dst_checktype(args.v[0], DST_FIBER)) return dst_throw(args, "expected fiber");
|
if (!dst_checktype(args.v[0], DST_FIBER)) return dst_throw(args, "expected fiber");
|
||||||
switch(dst_unwrap_fiber(args.v[0])->status) {
|
switch(dst_unwrap_fiber(args.v[0])->status) {
|
||||||
|
@ -84,16 +84,16 @@ static int checkflags(const uint8_t *str, int32_t len) {
|
|||||||
static IOFile *checkfile(DstArgs args, int32_t n) {
|
static IOFile *checkfile(DstArgs args, int32_t n) {
|
||||||
IOFile *iof;
|
IOFile *iof;
|
||||||
if (n >= args.n) {
|
if (n >= args.n) {
|
||||||
dst_throw(args, "expected core.file");
|
*args.ret = dst_cstringv("expected core.file");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!dst_checktype(args.v[n], DST_ABSTRACT)) {
|
if (!dst_checktype(args.v[n], DST_ABSTRACT)) {
|
||||||
dst_throw(args, "expected core.file");
|
*args.ret = dst_cstringv("expected core.file");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
iof = (IOFile *) dst_unwrap_abstract(args.v[n]);
|
iof = (IOFile *) dst_unwrap_abstract(args.v[n]);
|
||||||
if (dst_abstract_type(iof) != &dst_io_filetype) {
|
if (dst_abstract_type(iof) != &dst_io_filetype) {
|
||||||
dst_throw(args, "expected core.file");
|
*args.ret = dst_cstringv("expected core.file");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return iof;
|
return iof;
|
||||||
@ -105,11 +105,11 @@ static DstBuffer *checkbuffer(DstArgs args, int32_t n, int optional) {
|
|||||||
return dst_buffer(0);
|
return dst_buffer(0);
|
||||||
}
|
}
|
||||||
if (n >= args.n) {
|
if (n >= args.n) {
|
||||||
dst_throw(args, "expected buffer");
|
*args.ret = dst_cstringv("expected buffer");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!dst_checktype(args.v[n], DST_BUFFER)) {
|
if (!dst_checktype(args.v[n], DST_BUFFER)) {
|
||||||
dst_throw(args, "expected buffer");
|
*args.ret = dst_cstringv("expected buffer");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return dst_unwrap_abstract(args.v[n]);
|
return dst_unwrap_abstract(args.v[n]);
|
||||||
@ -118,11 +118,11 @@ static DstBuffer *checkbuffer(DstArgs args, int32_t n, int optional) {
|
|||||||
/* Check char array argument */
|
/* Check char array argument */
|
||||||
static int checkchars(DstArgs args, int32_t n, const uint8_t **str, int32_t *len) {
|
static int checkchars(DstArgs args, int32_t n, const uint8_t **str, int32_t *len) {
|
||||||
if (n >= args.n) {
|
if (n >= args.n) {
|
||||||
dst_throw(args, "expected string/buffer");
|
*args.ret = dst_cstringv("expected string/buffer");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!dst_chararray_view(args.v[n], str, len)) {
|
if (!dst_chararray_view(args.v[n], str, len)) {
|
||||||
dst_throw(args, "expected string/buffer");
|
*args.ret = dst_cstringv("expected string/buffer");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -553,7 +553,7 @@ static int cfun_parser(DstArgs args) {
|
|||||||
flags = 0;
|
flags = 0;
|
||||||
}
|
}
|
||||||
DstParser *p = dst_abstract(&dst_parse_parsertype, sizeof(DstParser));
|
DstParser *p = dst_abstract(&dst_parse_parsertype, sizeof(DstParser));
|
||||||
dst_parser_init(p, 0);
|
dst_parser_init(p, flags);
|
||||||
return dst_return(args, dst_wrap_abstract(p));
|
return dst_return(args, dst_wrap_abstract(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,16 +561,16 @@ static int cfun_parser(DstArgs args) {
|
|||||||
static DstParser *checkparser(DstArgs args) {
|
static DstParser *checkparser(DstArgs args) {
|
||||||
DstParser *p;
|
DstParser *p;
|
||||||
if (args.n == 0) {
|
if (args.n == 0) {
|
||||||
dst_throw(args, "expected parse.parser");
|
*args.ret = dst_cstringv("expected parse.parser");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!dst_checktype(args.v[0], DST_ABSTRACT)) {
|
if (!dst_checktype(args.v[0], DST_ABSTRACT)) {
|
||||||
dst_throw(args, "expected parse.parser");
|
*args.ret = dst_cstringv("expected parse.parser");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
p = (DstParser *) dst_unwrap_abstract(args.v[0]);
|
p = (DstParser *) dst_unwrap_abstract(args.v[0]);
|
||||||
if (dst_abstract_type(p) != &dst_parse_parsertype) {
|
if (dst_abstract_type(p) != &dst_parse_parsertype) {
|
||||||
dst_throw(args, "expected parse.parser");
|
*args.ret = dst_cstringv("expected parse.parser");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
Loading…
Reference in New Issue
Block a user