Fw: New Defects reported by Coverity Scan for ntpsec

Hal Murray halmurray at sonic.net
Mon Feb 6 01:38:49 UTC 2023


1439             default: {
1440     	    /* There should be a way for the compiler to check this. */
1441                 bool once =3D false;
>>>     CID 435753:  Possible Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return;". =20
1442                 if (once) return;		/* Avoid log file DDoS */

That's some of my new code.

In this case, I'm switching on a enum and have handled all the cases so the 
default "can't happen".

How do I get the compiler to tell me if I missed an option on a switch 
statement?

Of course, the data might get mashed, so the other question is:
  How do I get coverty to not complain about this code?



-- 
These are my opinions.  I hate spam.





More information about the devel mailing list