Bug 382472 - CODAN "no break after case" doesn't detect "no break" comment
Summary: CODAN "no break after case" doesn't detect "no break" comment
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: Next   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-13 05:49 EDT by Tom Collins CLA
Modified: 2013-07-17 20:57 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Collins CLA 2012-06-13 05:49:25 EDT
Build Identifier: Version: Indigo Service Release 2 Build id: 20120216-1857

When I get the "no break after case" warning, I can't clear it with a comment.

I first tried having CODAN fix the problem by inserting a comment (it chose "/* no break */"), but that didn't make the problem go away.  It put the comment in the correct place, but then didn't detect it.

I then tried changing the CODAN settings to use "fall through" as the comment, since that's what I've been using in my code base.

Still throws the warning.  Doesn't always happen though.  I tried to create a small example and the comment worked there.  The steps to reproduce contains a short excerpt of where it throws the error.

Reproducible: Sometimes

Steps to Reproduce:
	case ZCL_TYPE_LOGICAL_BOOLEAN:
		if (*rec->buffer & 0xFE)
		{
			#ifdef ZIGBEE_ZCL_VERBOSE
				printf( "%s: value 0x%02x is invalid for LOGICAL_BOOLEAN\n",
					__FUNCTION__, *rec->buffer);
			#endif
			newstatus = ZCL_STATUS_INVALID_VALUE;
			assign = FALSE;
		}
		/* fall through */

	default:	// covers most types
Comment 1 Nathan Ridge CLA 2013-07-17 20:57:07 EDT
I have noticed the following about the suppression comment:

 - There must be a line of text that contains nothing but a comment.
 - This comment must contain the suppression text. It may contain additional
   text as well.
 - This line must be the last non-whitespace line, including other comments, 
   before the next case.

Perhaps we could relax these requirements a bit.