URL:
<https://savannah.gnu.org/bugs/?54702>
Summary: [PATCH] hdb.cpp: Add information for the compiler to
avoid lack of clarity
Project: GNU troff
Submitted by: bjarniig
Submitted on: Thu 20 Sep 2018 11:41:10 PM UTC
Category: Preprocessor grn
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
_______________________________________________________
Details:
>From cf3f41f2f36628f994fbd7708ca9efe6ba9fe035 Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <[email protected]>
Date: Thu, 20 Sep 2018 23:20:26 +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 <[email protected]>
---
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..dbce049c 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/
_______________________________________________
bug-groff mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-groff