[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] regexec: fix unintentinal fallthrough warning with GCC7
From: |
Andrei Borzenkov |
Subject: |
Re: [PATCH] regexec: fix unintentinal fallthrough warning with GCC7 |
Date: |
Thu, 23 Mar 2017 20:11:05 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
23.03.2017 19:57, Bernhard Voelker пишет:
> 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. ;-)
>
To my surprise, it works :)
I do not care, really. Whatever is decided and accepted by gnulib
maintainers, as long as it is fixed in gnulib.