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)
Oct 14 2024, 2:22 AM
Unknown Object (File)
Sep 27 2024, 7:50 AM
Unknown Object (File)
Sep 26 2024, 11:49 PM
Unknown Object (File)
Sep 24 2024, 3:18 AM
Unknown Object (File)
Sep 18 2024, 3:45 PM
Unknown Object (File)
Sep 18 2024, 3:21 AM
Unknown Object (File)
Sep 11 2024, 10:37 AM
Unknown Object (File)
Sep 5 2024, 4:40 AM
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.