Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From deff7d2d59ed063e24aea5be2a1ad329dd5a0b45 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Sat, 6 Mar 2021 02:24:24 +0000
>Subject: [PATCH] menu.c: Add FALLTHROUGH to avoid warnings

  In case constructs:

  Add several "/* FALLTHROUGH */ /* to avoid a warning */".

  Add a "return 0;" after a returning function, to avoid a warning.

  Add information to the output of a "sys_error(...)" function.

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 menu.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/menu.c b/menu.c
index b91a974..0dfee2c 100644
--- a/menu.c
+++ b/menu.c
@@ -1295,6 +1295,7 @@ draw_menu:
                    case 1:
                        if ((ah->flag & A_ROOT_ART) == 0)
                            break;
+                       /* FALLTHROUGH */ /* to avoid a warning */
                        /* XXX: bug? Another fall? */
                    case 2:
                        menu_length++;
@@ -1484,6 +1485,9 @@ new_state:
 
                case AC_REENTER_GROUP:
                    menu_return(ME_REENTER_GROUP);
+ /* Previous command returns, but the compiler can't know that,
+so "return 0;" is used to tell that */
+                   return 0; /* avoid a "fallthrough" warning */
            }
            /* XXX: bug? fall */
 
@@ -1622,6 +1626,7 @@ new_state:
                        case 3:
                            if (ah->attr == 0)
                                break;
+                           /* FALLTHROUGH */ /* to avoid a warning */
                            /* XXX: check fall */
                        case 1:
                            if ((ah->attr & A_SELECT) == 0)
@@ -1860,6 +1865,7 @@ new_state:
                    goto empty_menu_hack;
            }
 
+           /* FALLTHROUGH */ /* avoid a warning */
            /* XXX: Fall ? */
        case K_OPEN_SUBJECT:
            if (numa < 0)
@@ -2251,6 +2257,7 @@ new_state:
                        case 1:
                            if ((articles[nexta]->flag & A_ROOT_ART) == 0)
                                break;
+                           /* FALLTHROUGH */ /* to avoid a warning */
                            /* XXX: fall? */
                        case 2:
                            --menu_length;
@@ -2405,6 +2412,7 @@ do_auto_read:
                    firsta = nexta;
                goto redraw;
            }
+           goto defaut; /* Uncertain code, avoid a warning */
            /* XXX: fall? */
        case MC_NEXTGROUP:
            menu_cmd = ME_NEXT;
@@ -2419,7 +2427,8 @@ do_auto_read:
            break;
 
        default:
-           sys_error("show_articles returned improper value");
+           sys_error("File %s, line %d: show_articles returned improper value, 
%d",
+                       __FILE__, __LINE__, show_artices());
     }
 
 menu_exit:
-- 
2.30.1



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to