bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] regexec: fix unintentinal fallthrough warning with GCC7


From: Bernhard Voelker
Subject: Re: [PATCH] regexec: fix unintentinal fallthrough warning with GCC7
Date: Thu, 23 Mar 2017 17:57:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 03/23/2017 05:27 PM, Andrei Borzenkov wrote:
> If RE_ENABLE_I18N is not defined, FALLTHROUGH will be attributed to
> wrong branch. If someone happens to add case label before #ifdef, it
> will be rather hard to spot.

What about this?

diff --git a/lib/regexec.c b/lib/regexec.c
index ef52b243a..107a5c035 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -4079,7 +4079,10 @@ check_node_accept (const re_match_context_t *mctx, const 
re_token_t *node,
       if (ch >= ASCII_CHARS)
         return false;
       /* FALLTHROUGH */
+      goto FALLTHRU_TO_OP_PERIOD;
 #endif
+
+FALLTHRU_TO_OP_PERIOD:
     case OP_PERIOD:
       if ((ch == '\n' && !(mctx->dfa->syntax & RE_DOT_NEWLINE))
          || (ch == '\0' && (mctx->dfa->syntax & RE_DOT_NOT_NULL)))


Okay, some consider goto as ugly ... but it is explicit and
probably efficient as well in this case. ;-)

Have a nice day,
Berny



reply via email to

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