tech-userlevel archive

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

Fixing lint warnings



On Thu, 22 Mar 2012, Joerg Sonnenberger wrote:
So let's do this properly. Many of this changes are just bogus. I still haven't seen a single case that wouldn't be handled by the compiler as well. So I want to request:

(a) Disabling lint completely. It is noise, it creates a lot harder to follow diagnostics than either gcc or clang, it adds no real value as compiler.

(b) Revert all changes to appease lint that don't also trigger a warning with at least -Wconversion -Wno-error=conversion or similar warning.

(c) Consider adding the above flags to the build by default.

(d) Check if the ABI compliance checker fills all the needs for ABI consistency lint provided, few as they were.

(e) Add a GSoC project or funded project to implement equivalent functionality either based on DWARF or libclang to the base system.

In the long term, I think that we should consider replacing lint, but I have no concrete suggestions.

In the medium term, I think that we should continue to use lint, and to fix problems that it reports. However, some of the things that it reports are not real problems, but are bogus warnings that are traceable to limitations in the analysis done by lint, and these should not simply be silenced by adding casts.

In cases where humans think that the lint warnings are bogus, I'd like us to silence the warnings in one of these ways:

  a) Improve the analysis done by lint, so that it no longer issues
     the bogus warnings;

  b) Enhance the way /*LINTED*/ comments work, so that the "247" in
     /* LINTED 247 pointer casts may be troublesome */ actually means
     something; then add such comments to suppress warnings on a
     per-line-per-warning basis.

  c) Even if (b) is not done, use /*LINTED*/ comments to suppress
     warnings on a per-line basis.

  d) Use Makefile variables like "LINTFLAGS.filename += -X 247"
     to suppress warnings on a per-file-per-warning basis.

  e) Do not add casts merely to silence bogus warnings.  Add
     casts only where they improve the readability, portability,
     correctness, or style of the code.

In the short term, leaving the tree in a state where it does not build is bad. If passing the "-w" flag to lint causes build failures that cannot be fixed very quickly, then I think we should stop passing the"-w" flag to lint.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index