From: jason@perfinion.com (Jason Zaman) Date: Tue, 6 Jun 2017 00:31:26 +0800 Subject: [refpolicy] [PATCH v2] fc_sort: avoid compiler warning/error In-Reply-To: <1496675093.4528.4.camel@trentalancia.com> References: <1496674594.4528.3.camel@trentalancia.com> <1496675093.4528.4.camel@trentalancia.com> Message-ID: <20170605163126.GA29487@meriadoc.perfinion.com> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com On Mon, Jun 05, 2017 at 05:04:53PM +0200, Guido Trentalancia via refpolicy wrote: > Fix a "-Werror=implicit-fallthrough" compiler warning/error on > the switch statement. > > This second version (v2) fixes a bug introduced with the previous > version. > > Signed-off-by: Guido Trentalancia > --- > support/fc_sort.c | 5 +++++ > 1 file changed, 5 insertions(+) > > --- a/support/fc_sort.c 2017-03-29 17:57:54.576386420 +0200 > +++ b/support/fc_sort.c 2017-06-05 17:01:44.818724998 +0200 > @@ -292,6 +292,11 @@ void fc_fill_data(file_context_node_t *f > /* If a escape character is found, > * skip the next character. */ > c++; > + /* If no meta character has been found yet, > + * add one to the stem length. */ > + if (!fc_node->meta) > + fc_node->stem_len++; > + break; Why not just add /* -fallthrough */ instead of the break? Seems more maintainable than duplicating the code in case something changes later. https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html -- Jason > default: > /* If no meta character has been found yet, > * add one to the stem length. */ > _______________________________________________ > refpolicy mailing list > refpolicy at oss.tresys.com > http://oss.tresys.com/mailman/listinfo/refpolicy