Page MenuHomeFreeBSD

Increase libthr WARNS to the default of 6, and fix the warnings
ClosedPublic

Authored by vangyzen on May 18 2017, 11:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 10:37 AM
Unknown Object (File)
Dec 11 2023, 6:42 AM
Unknown Object (File)
Dec 5 2023, 7:44 PM
Unknown Object (File)
Nov 13 2023, 4:45 AM
Unknown Object (File)
Nov 11 2023, 2:49 PM
Unknown Object (File)
Nov 7 2023, 2:04 AM
Unknown Object (File)
Nov 6 2023, 3:16 AM
Unknown Object (File)
Oct 10 2023, 1:51 PM
Subscribers

Details

Summary

Increase libthr WARNS to the default of 6, and fix the warnings

Fix warnings about:

  • casting away volatile and const
  • unused parameters
  • a variable in a macro shadowing a local in a calling function
  • no previous 'extern' declaration for non-static variable
  • others as explained by #pragmas and comments

These have no effect, except for removing an unused parameter.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I've just realized that all of the #pragma GCC should probably be #pragma clang.

Perhaps commit the changes which do not cause a discussion, now, to reduce the patch size.

lib/libc/include/spinlock.h
47 ↗(On Diff #28541)

Arguably, if fname is not volatile, lineno could be as well.

That said, debugging 'support' for libc spinlocks was never used for last 10-15 years, I suggest to remove it at all.

lib/libthr/thread/thr_mutex.c
772 ↗(On Diff #28541)

I argue that whole libthr should be compiled with this warning disabled. It is the only reasonable approach for the code which implements the locks. In other words, I suggest to move the warning disabling flag into libthr Makefile.

lib/libthr/thread/thr_rwlock.c
63 ↗(On Diff #28541)

I think it is not too hard to replace the macro use with static (might be inline) initializer function.

lib/libc/include/spinlock.h
47 ↗(On Diff #28541)

I kept this minimal to keep the patch small. As you suggest, I'll remove this code in a separate commit.

lib/libthr/thread/thr_mutex.c
772 ↗(On Diff #28541)

Yes, I tend to agree. Although the warnings might be helpful in some files, the chance of false positives is too high.

lib/libthr/thread/thr_rwlock.c
63 ↗(On Diff #28541)

Agreed, and I would strongly prefer that. As before, it will be a separate commit.

This revision was automatically updated to reflect the committed changes.