From 85ece882689527ad8f73cf05637dfca2b3fcb048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ni=C3=B1o=20D=C3=ADaz?= Date: Sun, 1 Apr 2018 01:54:42 +0100 Subject: [PATCH] Add default clauses to switch statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antonio Niño Díaz --- src/asm/fstack.c | 6 ++++++ src/asm/globlex.c | 3 +++ src/asm/lexer.c | 4 ++-- src/link/assign.c | 3 +++ src/link/patch.c | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/asm/fstack.c b/src/asm/fstack.c index 19d58e20..ead50395 100644 --- a/src/asm/fstack.c +++ b/src/asm/fstack.c @@ -87,6 +87,8 @@ static void pushcontext(void) (*ppFileStack)->nREPTBlockSize = nCurrentREPTBlockSize; (*ppFileStack)->nREPTBlockCount = nCurrentREPTBlockCount; break; + default: + fatalerror("%s: Internal error.", __func__); } nLineNo = 0; @@ -152,6 +154,8 @@ static int32_t popcontext(void) nCurrentREPTBlockSize = pLastFile->nREPTBlockSize; nCurrentREPTBlockCount = pLastFile->nREPTBlockCount; break; + default: + fatalerror("%s: Internal error.", __func__); } free(*ppLastFile); @@ -174,6 +178,8 @@ int32_t fstk_GetLine(void) return nLineNo; /* ??? */ case STAT_isREPTBlock: break; /* Peek top file of the stack */ + default: + fatalerror("%s: Internal error.", __func__); } pLastFile = pFileStack; diff --git a/src/asm/globlex.c b/src/asm/globlex.c index 9dae47bc..b25afde0 100644 --- a/src/asm/globlex.c +++ b/src/asm/globlex.c @@ -93,6 +93,9 @@ static int32_t ascii2bin(char *s) s += 1; convertfunc = binary2bin; break; + default: + /* Handle below */ + break; } if (radix == 4) { diff --git a/src/asm/lexer.c b/src/asm/lexer.c index b789f567..fd0b3d17 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -850,7 +850,7 @@ uint32_t yylex(void) return yylex_NORMAL(); case LEX_STATE_MACROARGS: return yylex_MACROARGS(); + default: + fatalerror("%s: Internal error.", __func__); } - - fatalerror("Internal error in %s", __func__); } diff --git a/src/link/assign.c b/src/link/assign.c index fca668cd..73c644ae 100644 --- a/src/link/assign.c +++ b/src/link/assign.c @@ -617,6 +617,9 @@ void AssignSections(void) pSection->nOrg, pSection->nBank); } break; + default: + errx(1, "%s: Internal error: Type %d", __func__, + pSection->Type); } } diff --git a/src/link/patch.c b/src/link/patch.c index 9d704264..f3d036bf 100644 --- a/src/link/patch.c +++ b/src/link/patch.c @@ -325,6 +325,8 @@ void Patch(void) pPatch->nLineNo); } break; + default: + errx(1, "%s: Internal error.", __func__); } pPatch = pPatch->pNext;