[ovs-dev] sparse issues

Stokes, Ian ian.stokes at intel.com
Thu Jan 11 20:44:06 UTC 2018


> There's been some talk about how sparse isn't working properly for you or
> some others.  Let's try to figure that out.
> 

I had more time to investigate this on my system but still no resolution, findings inline below.

> A few possibilities come to mind:
> 
> - Maybe sparse isn't being detected at configure time.  If it is
>   detected, then Makefile should contain a nasty mess of a "make"
>   conditional expression for the definition of CC; if not, then it
>   should look normal.

Confirmed that Makefile is using sparse. 

> 
> - Maybe "make" isn't being run with C=1.

Confirmed that make is run with C=1.

> 
> - --enable-Werror doesn't properly make the build fail when sparse
>   reports a warning.  This means that it's easy to miss the warnings
>   if you run "make" twice.

I suspect this is the case.

For example with the odp-util sparse warning I looked at today, I ran configure with --enable-Werror and then enabled sparse on compilation as above.

The build succeeded but when I manually inspected the compilation output I spotted the sparse warning. So it seems sparse warnings aren't treated as errors. I know in the past they definitely were flagged as an error on my system.

Ian
> 
> Here's something you can try.  Apply a patch like the following, then run
> "make clean; make C=1".  Do you get a huge pile of error messages from
> sparse?  I do.
> 
> diff --git a/include/sparse/netinet/in.h b/include/sparse/netinet/in.h
> index c28158ca02f5..93b0bac83997 100644
> --- a/include/sparse/netinet/in.h
> +++ b/include/sparse/netinet/in.h
> @@ -14,6 +14,8 @@
>   * limitations under the License.
>   */
> 
> +#error
> +
>  #ifndef __CHECKER__
>  #error "Use this header only with sparse.  It is not a correct
> implementation."
>  #endif
> 



More information about the dev mailing list