bug-groff
[Top][All Lists]
Advanced

[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 19:41:11 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

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 <address@hidden>
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 <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..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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]