On Sun, Sep 25, 2022 at 11:23 AM Richard Cochran
<richardcoch...@gmail.com> wrote:
>
> On Thu, Jul 21, 2022 at 03:10:40PM +0530, Siddharth Vadapalli via 
> Linuxptp-devel wrote:
> > Remove the unreachable switch case TS_SOFTWARE.
> >
> > Signed-off-by: Siddharth Vadapalli <s-vadapa...@ti.com>
> > ---
> >  sk.c | 3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/sk.c b/sk.c
> > index b55d6b5..a49bcf4 100644
> > --- a/sk.c
> > +++ b/sk.c
> > @@ -477,9 +477,6 @@ int sk_timestamping_init(int fd, const char *device, 
> > enum timestamp_type type,
> >       if (type != TS_SOFTWARE) {
> >               filter1 = HWTSTAMP_FILTER_PTP_V2_EVENT;
> >               switch (type) {
> > -             case TS_SOFTWARE:
> > -                     tx_type = HWTSTAMP_TX_OFF;
> > -                     break;
>
> This introduces a build failure with -Werror
>
> /home/richard/git/linuxptp/sk.c: In function ‘sk_timestamping_init’:
> /home/richard/git/linuxptp/sk.c:484:3: error: enumeration value ‘TS_SOFTWARE’ 
> not handled in switch [-Werror=switch]
>    switch (type) {
>    ^~~~~~
> cc1: all warnings being treated as errors
> make: *** [<builtin>: sk.o] Error 1
>
> So NAK to this patch.

I've developed the habit of closing all non-exhaustive switches where
no sensible default exists with a default which asserts with a
meaningful diagnostic.  Doing so has helped me find a number of my own
mistaken assumptions.  I suspect, however, that a project with as many
eyes on it as this one won't have too many of those.

-michael


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to