Page MenuHomeFreeBSD

libthr: use default WARNS level of 6, and fix warnings
ClosedPublic

Authored by vangyzen on May 20 2017, 3:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 4:22 AM
Unknown Object (File)
Mon, Nov 18, 4:21 AM
Unknown Object (File)
Sun, Oct 27, 5:39 PM
Unknown Object (File)
Sep 21 2024, 1:50 PM
Unknown Object (File)
Sep 20 2024, 8:26 AM
Unknown Object (File)
Sep 19 2024, 10:56 AM
Unknown Object (File)
Sep 18 2024, 7:10 PM
Unknown Object (File)
Sep 18 2024, 2:37 AM
Subscribers

Details

Summary

I plan to make a Subversion commit for each of these Git commits.

commit 7cf976f4c5161202bbb2469f90fd0278a84823e2
Author: Eric van Gyzen <eric@vangyzen.net>
Date: Sat May 20 10:06:08 2017 -0500

libthr: Use CLI flags instead of pragmas to disable warnings

People tweaking the build system or compilers tend to look into
the Makefile and not into the source.  Having some warning controls
in the Makefile and some in the source code is surprising.

Pragmas have the advantage that they leave the warnings enabled
for more code, but that advantage isn't very relevant in these cases.

Requested by:   kib

lib/libthr/Makefile | 6 ++++++
lib/libthr/thread/thr_stack.c | 17 -----------------
lib/libthr/thread/thr_symbols.c | 4 ----
3 files changed, 6 insertions(+), 21 deletions(-)

commit 349c64ef020bf9142e2d7cb570a67d3e79af67da
Author: Eric van Gyzen <eric@vangyzen.net>
Date: Fri May 19 10:14:09 2017 -0500

libthr: use default WARNS level of 6

lib/libthr/Makefile | 1 -
1 file changed, 1 deletion(-)

commit 5b0e584d02b4a3de24f14e5ffe829bf766f1b6aa
Author: Eric van Gyzen <eric@vangyzen.net>
Date: Fri May 19 10:12:22 2017 -0500

Remove old spinlock_debug code from libc

This no longer seems useful.  Remove it.

This was prompted by a "cast discards volatile qualifier" warning
in libthr when WARNS=6.

lib/libc/gen/Symbol.map | 1 -
lib/libc/gen/_spinlock_stub.c | 2 --
lib/libc/include/spinlock.h | 13 ++++---------
lib/libthr/thread/thr_init.c | 1 -
lib/libthr/thread/thr_spinlock.c | 12 ++++++------
5 files changed, 10 insertions(+), 19 deletions(-)

commit 3f6bdee0ec8e3d5f6b59df6e31cfac5283907695
Author: Eric van Gyzen <eric@vangyzen.net>
Date: Fri May 19 08:56:56 2017 -0500

libthr: change CHECK_AND_INIT_RWLOCK to an inline function

This was prompted by a compiler warning about 'ret' shadowing
a local variable in the callers of the macro.

lib/libthr/thread/thr_rwlock.c | 71 ++++++++++++++++++++++++++++--------------
1 file changed, 47 insertions(+), 24 deletions(-)

commit ed979a9da9759c62ef56436966a9b414212da073
Author: Eric van Gyzen <eric@vangyzen.net>
Date: Fri May 19 08:29:09 2017 -0500

libthr: disable thread-safety warnings

These warnings don't make sense for code that implements
the locking primitives.

lib/libthr/Makefile | 1 +
1 file changed, 1 insertion(+)

Diff Detail

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

Event Timeline

vangyzen edited the summary of this revision. (Show Details)
lib/libthr/thread/thr_rwlock.c
60 ↗(On Diff #28606)

return (init_rwlock(...));

65 ↗(On Diff #28606)

I am curious why did you marked the function as __noinline ?

76 ↗(On Diff #28606)

Please move the local declaration into the declaration block right after opening "{", according to style.

78 ↗(On Diff #28606)

if (ret != 0)

I was hoping I could remove more spinlock code, but I don't think so.

lib/libthr/Makefile
33 ↗(On Diff #28606)

I tried ​CFLAGS.clang.thr_symbols.c and ​CFLAGS.thr_symbols.c.clang, but neither worked. GCC 4.6 accepts this flag, so testing the compiler version is arguably more correct anyway.

lib/libthr/thread/thr_rwlock.c
55 ↗(On Diff #28606)

Without these __...inline attributes, clang apparently inlined init_rwlock into check_and_init_rwlock and then decided that check_and_init_rwlock was too big to inline. This is disappointing. Also, the standard inline keyword had no effect, of course.

lib/libthr/thread/thr_rwlock.c
65 ↗(On Diff #28606)

See line 55. (You and I were writing at the same time.)

vangyzen edited the summary of this revision. (Show Details)

Fix style in thr_rwlock.c.

This revision is now accepted and ready to land.May 20 2017, 3:52 PM
This revision was automatically updated to reflect the committed changes.