Powered by Linux
Re: smatch output — Semantic Matching Tool

Re: smatch output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2014-04-28 at 16:07 +0300, Dan Carpenter wrote:
> On Thu, Apr 24, 2014 at 03:41:38PM -0700, Artem Bityutskiy wrote:
> > Hi Dan,
> > 
> > here is the problematic warning.
> > 
> > 
> > -kernel/cgroup.c:2269 cgroup_release_agent_write() warn: inconsistent returns mutex:&cgroup_mutex: locked (2235 [(-22)], 2237 [(-19)]) unlocked (2242 [0]) [smatch]
> > +kernel/cgroup.c:2269 cgroup_release_agent_write() warn: inconsistent returns mutex:&cgroup_mutex: locked (2262 [(-22)], 2264 [(-19)]) unlocked (2269 [0]) [smatch]
> > 
> > Basically, this is the same warning, it  present before patching the
> > kernel and after patching it. So aiaiai should not tell about it, but it
> > does, which is a problem I need to fix somehow.
> > 
> > As you see, the line number is amended by aiaiai (2269). However, you
> > include other line numbers, which aiaiai does not amend.
> > 
> > At the moment aiaiai amends line numbers like this:
> > 
> > 1. Pattern: ^path/to/file.c:XXX.* - XXX number is amended
> > 2. Pattern: .*line XXX.* - XXX number is corrected
> > 
> > And I think it now only amends the first occurrence of "line XXX", but
> > this could be changes.
> > 
> > Would you consider to prefix all line numbers you output with "line",
> > sot that you'd end up with:
> > 
> > (line 2235 [(-22)], line 2237 [(-19)]) unlocked (line 2242 [0]) [smatch]
> > 
> > instead?
> > 
> 
> I've been promising to fix this error message format for a while...
> Part of the problem is that the warning is too long, and adding a bunch
> of "line " words in the middle will just make it longer.
> 
> The other problem is that it's just confusing.  In your example the
> -22 and -19 are the error return codes.  I don't think people understand
> that.
> 
> Maybe the warning should be:
> kernel/cgroup.c:2269 cgroup_release_agent_write() warn: inconsistent returns mutex:&cgroup_mutex. Locked on line 2235, line 2237. Unlocked on line 2269.
> 
> A line number could appear as both locked and unlocked as well.
> 
> How do people like that format?

Well, frankly, I'd prefer if you split it and printed multiple lines.
Just start each line with a white-space or several white-spaces. And
print a single line number per line of output.

kernel/cgroup.c:2269 cgroup_release_agent_write() warn: inconsistent returns mutex:&cgroup_mutex.
  Locked on:   line 2235
               line 2237
  Unlocked on: line 2269

This would be easy to parse.

Note, GCC also outputs so that when the next line belongs to the
previous, and does not have a distinctive prefix, it starts with a
white-space (I did not check gcc code to verify this, but this is what I
observe).

--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux