Skip to content

Commit f49e0ac

Browse files
author
Chris Warren-Smith
committed
COMMON: fix compiler warnings
1 parent 589b95d commit f49e0ac

6 files changed

Lines changed: 18 additions & 8 deletions

File tree

src/common/blib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ bcip_t cmd_push_args(int cmd, bcip_t goto_addr, bcip_t rvid) {
10021002

10031003
prog_ip = ofs; // back to the start of the expression
10041004
// now we are sure, this parameter is not a single variable
1005-
// no 'break' here
1005+
// fallthrough
10061006

10071007
default:
10081008
// default: the parameter is an expression
@@ -1096,7 +1096,7 @@ void cmd_call_unit_udp(int cmd, int udp_tid, bcip_t goto_addr, bcip_t rvid) {
10961096

10971097
prog_ip = ofs; // back to the start of the expression
10981098
// now we are sure, this parameter is not a single variable
1099-
// no 'break' here
1099+
// fallthrough
11001100

11011101
default:
11021102
// default: the parameter is an expression

src/common/blib_func.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,8 @@ void cmd_genfunc(long funcCode, var_t *r) {
25742574
}
25752575
}
25762576
prog_ip = ofs;
2577-
// no 'break' here
2577+
// fallthrough
2578+
25782579
default:
25792580
// default --- expression
25802581
v_init(&arg);
@@ -2646,7 +2647,8 @@ void cmd_genfunc(long funcCode, var_t *r) {
26462647
}
26472648
}
26482649
prog_ip = ofs;
2649-
// no 'break' here
2650+
// fallthrough
2651+
26502652
default:
26512653
// default --- expression
26522654
v_init(&arg);

src/common/ceval.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,11 @@ void cev_prim() {
198198
case kwTYPE_CALLEXTF: // [lib][index]
199199
bc_add_n(bc_out, bc_in->ptr + bc_in->cp, ADDRSZ);
200200
IP += ADDRSZ; // no break here
201+
// fallthrough
201202
case kwTYPE_CALLF: // [code]
202203
bc_add_n(bc_out, bc_in->ptr + bc_in->cp, ADDRSZ);
203204
IP += ADDRSZ; // no break here
205+
// fallthrough
204206
default:
205207
if (CODE_PEEK() == kwTYPE_LEVEL_BEGIN) {
206208
if (CODE(IP + 1) == kwTYPE_LEVEL_END) {

src/common/plugins.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ int plugin_import(const char *name, const char *alias) {
443443
for (int i = 0; i < MAX_SLIBS; i++) {
444444
if (!plugins[i]) {
445445
// found free slot
446-
slib_t *lib = plugins[i] = (slib_t *)calloc(sizeof(slib_t), 1);
446+
slib_t *lib = plugins[i] = (slib_t *)calloc(1, sizeof(slib_t));
447447
if (!lib) {
448448
sc_raise("LIB: plugin_import failed");
449449
break;
@@ -465,7 +465,7 @@ int plugin_import(const char *name, const char *alias) {
465465
void plugin_open(const char *name, int lib_id) {
466466
slib_t *lib = get_lib(lib_id);
467467
if (!lib && lib_id >= 0 && lib_id < MAX_SLIBS) {
468-
lib = plugins[lib_id] = (slib_t *)calloc(sizeof(slib_t), 1);
468+
lib = plugins[lib_id] = (slib_t *)calloc(1, sizeof(slib_t));
469469
if (lib) {
470470
char path[PATH_SIZE];
471471
char file[PATH_SIZE];
@@ -622,7 +622,8 @@ int plugin_build_ptable(slib_par_t *ptable, int size) {
622622

623623
// restore IP
624624
prog_ip = ofs;
625-
// no 'break' here
625+
// fallthrough
626+
626627
default:
627628
// default --- expression (BYVAL ONLY)
628629
arg = v_new();

src/common/proc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,8 @@ int par_getpartable(par_t **ptable_pp, const char *valid_sep, unsigned max_items
878878
// Its no a single variable, its an expression
879879
// restore IP
880880
prog_ip = ofs;
881+
// fallthrough
881882

882-
// no 'break' here
883883
default:
884884
// default --- expression (BYVAL ONLY)
885885
par = v_new();
@@ -1026,6 +1026,7 @@ int par_massget(const char *fmt, ...) {
10261026
va_arg(ap, char **);
10271027
break;
10281028
}
1029+
// fallthrough
10291030
case 'S':
10301031
// string
10311032
s = va_arg(ap, char **);
@@ -1038,6 +1039,7 @@ int par_massget(const char *fmt, ...) {
10381039
va_arg(ap, var_int_t *);
10391040
break;
10401041
}
1042+
// fallthrough
10411043
case 'I':
10421044
// integer
10431045
i = va_arg(ap, var_int_t *);
@@ -1050,6 +1052,7 @@ int par_massget(const char *fmt, ...) {
10501052
va_arg(ap, var_num_t *);
10511053
break;
10521054
}
1055+
// fallthrough
10531056
case 'F':
10541057
// real (var_num_t)
10551058
f = va_arg(ap, var_num_t *);
@@ -1062,6 +1065,7 @@ int par_massget(const char *fmt, ...) {
10621065
va_arg(ap, var_t **);
10631066
break;
10641067
}
1068+
// fallthrough
10651069
case 'P':
10661070
// variable
10671071
vt = va_arg(ap, var_t **);

src/lib/match.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ int reg_match_jk(const char *p, char *t) {
228228
*/
229229
if (*p == '\0')
230230
return reg_match_bad_pattern;
231+
// fallthrough
231232

232233
/*
233234
* must match this character exactly

0 commit comments

Comments
 (0)