[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #54702] [PATCH] hdb.cpp: Add information for the compiler to avoid
From: |
Bjarni Ingi Gislason |
Subject: |
[bug #54702] [PATCH] hdb.cpp: Add information for the compiler to avoid lack of clarity |
Date: |
Thu, 20 Sep 2018 20:36:14 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 |
Follow-up Comment #1, bug #54702 (project groff):
I forgot to add <minus>verbatim<minus> at the end of the original comment.
Correct the patch as I forgot to add a semicolon after the "return (0)".
>From 7403a7a85f4e5fb15b4fc3a039c7f7963570e0f9 Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <address@hidden>
Date: Fri, 21 Sep 2018 00:05:35 +0000
Subject: [PATCH] hdb.cpp: Add information for the compiler to avoid lack of
clarity
A question from the compiler (gcc 8.2) (example):
../src/preproc/grn/hdb.cpp:260:12: warning: this statement may fall through
[-Wimplicit-fallthrough=]
fatal("unknown element type");
Add an explicit "return", so that the compiler knows that there is no
possibility of a "fallthrough".
Signed-off-by: Bjarni Ingi Gislason <address@hidden>
---
src/preproc/grn/hdb.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/preproc/grn/hdb.cpp b/src/preproc/grn/hdb.cpp
index fe722c6a..f2463f3c 100644
--- a/src/preproc/grn/hdb.cpp
+++ b/src/preproc/grn/hdb.cpp
@@ -246,6 +246,7 @@ DBGetType(register char *s)
default:
fatal("unknown element type");
// fatal() does not return
+ return (0); // avoid a warning about possible fallthrough
}
case 'B':
switch (s[3]) {
@@ -258,6 +259,7 @@ DBGetType(register char *s)
default:
fatal("unknown element type");
// fatal() does not return
+ return (0); // avoid a warning about a possible fallthrough
}
case 'T':
switch (s[3]) {
@@ -270,6 +272,7 @@ DBGetType(register char *s)
default:
fatal("unknown element type");
// fatal() does not return
+ return (0); // avoid a warning about a possible fallthrough
}
default:
fatal("unknown element type");
--
2.18.0
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54702>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/