diff options
author | D G Turner | 2019-09-03 10:01:50 +0100 |
---|---|---|
committer | D G Turner | 2019-09-03 10:01:50 +0100 |
commit | cf823c0733a3a6c74545f912c4d0a438a35f785d (patch) | |
tree | fd6fee6bf7a0cfe120d4418084b127916d6e83ec /engines/glk/tads | |
parent | 25e32b206798689ea41d704583ff50cf15e06643 (diff) | |
download | scummvm-rg350-cf823c0733a3a6c74545f912c4d0a438a35f785d.tar.gz scummvm-rg350-cf823c0733a3a6c74545f912c4d0a438a35f785d.tar.bz2 scummvm-rg350-cf823c0733a3a6c74545f912c4d0a438a35f785d.zip |
GLK: TADS: Fix GCC Compiler Warnings
These were several undeclared fallthrough warnings i.e. after error
handler cases which will not return and another case of usage of
memset on a non-trivial structure which was fixed by using structure
constructor methods instead.
Diffstat (limited to 'engines/glk/tads')
-rw-r--r-- | engines/glk/tads/tads2/built_in.h | 2 | ||||
-rw-r--r-- | engines/glk/tads/tads2/regex.h | 8 | ||||
-rw-r--r-- | engines/glk/tads/tads2/run.cpp | 10 | ||||
-rw-r--r-- | engines/glk/tads/tads2/runtime_driver.cpp | 1 |
4 files changed, 13 insertions, 8 deletions
diff --git a/engines/glk/tads/tads2/built_in.h b/engines/glk/tads/tads2/built_in.h index 5078eda2ee..c735d5627f 100644 --- a/engines/glk/tads/tads2/built_in.h +++ b/engines/glk/tads/tads2/built_in.h @@ -52,6 +52,8 @@ struct biffildef { osfildef *fp; /* underyling system file handle */ uint flags; /* flags */ #define BIFFIL_F_BINARY 0x01 /* file is binary */ + + biffildef() : fp(nullptr), flags(0) {} }; /* built-in execution context */ diff --git a/engines/glk/tads/tads2/regex.h b/engines/glk/tads/tads2/regex.h index 48c2dd0ad4..0f3acfc18b 100644 --- a/engines/glk/tads/tads2/regex.h +++ b/engines/glk/tads/tads2/regex.h @@ -46,10 +46,12 @@ typedef int re_state_id; * Group register structure. Each register keeps track of the starting * and ending offset of the group's text. */ -typedef struct +typedef struct _re_group_register { const char *start_ofs; const char *end_ofs; + + _re_group_register() : start_ofs(nullptr), end_ofs(nullptr) {} } re_group_register; /* number of group registers we keep */ @@ -98,7 +100,7 @@ typedef struct * state of the compilation and stores the resources associated with the * compiled expression. */ -typedef struct +typedef struct _re_context { /* error context */ errcxdef *errctx; @@ -135,6 +137,8 @@ typedef struct /* size of the buffer allocated to strbuf */ size_t strbufsiz; + + _re_context() : errctx(nullptr), next_state(0), tuple_arr(nullptr), tuples_alloc(0), cur_group(0), strbuf(nullptr), curlen(0), strbufsiz(0) {} } re_context; diff --git a/engines/glk/tads/tads2/run.cpp b/engines/glk/tads/tads2/run.cpp index 0def6a771b..03fd80a501 100644 --- a/engines/glk/tads/tads2/run.cpp +++ b/engines/glk/tads/tads2/run.cpp @@ -1397,8 +1397,8 @@ resume_from_error: runrepush(ctx, otherbp + runrp2s(p + 4) - 1); p += 6; } - break; #endif + break; case OPCGETLCL: runrepush(ctx, ctx->runcxbp + runrp2s(p) - 1); @@ -1659,19 +1659,19 @@ resume_from_error: case OPCEXIT: errsig(ctx->runcxerr, ERR_RUNEXIT); - /* NOTREACHED */ + break; case OPCABORT: errsig(ctx->runcxerr, ERR_RUNABRT); - /* NOTREACHED */ + break; case OPCASKDO: errsig(ctx->runcxerr, ERR_RUNASKD); - /* NOTREACHED */ + break; case OPCASKIO: errsig1(ctx->runcxerr, ERR_RUNASKI, ERRTINT, osrp2(p)); - /* NOTREACHED */ + break; case OPCJE: p += (runeq(ctx) ? runrp2s(p) : 2); diff --git a/engines/glk/tads/tads2/runtime_driver.cpp b/engines/glk/tads/tads2/runtime_driver.cpp index 6f1674d3ac..2eb6602077 100644 --- a/engines/glk/tads/tads2/runtime_driver.cpp +++ b/engines/glk/tads/tads2/runtime_driver.cpp @@ -675,7 +675,6 @@ static void trdmain1(errcxdef *ec, int argc, char *argv[], dbg.dbgcxlin = (lindef *)0; /* no line sources yet */ /* set up built-in function context */ - CLRSTRUCT(bifctx); bifctx.bifcxerr = ec; bifctx.bifcxrun = &runctx; bifctx.bifcxtio = (tiocxdef *)0; |