Page MenuHomeFreeBSD

Suppress -Wempty-body warnings in GCC 6.x and later.
ClosedPublic

Authored by jhb on Aug 31 2020, 8:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jul 26, 1:00 AM
Unknown Object (File)
Fri, Jul 24, 9:22 PM
Unknown Object (File)
Wed, Jul 22, 1:02 PM
Unknown Object (File)
Sun, Jul 19, 5:29 PM
Unknown Object (File)
Sun, Jul 19, 11:56 AM
Unknown Object (File)
Sat, Jul 18, 7:18 AM
Unknown Object (File)
Sun, Jul 12, 5:02 AM
Unknown Object (File)
Thu, Jul 9, 2:08 AM
Subscribers

Details

Summary

libc++ in LLVM 11 uses an empty else clause in
include/c++/v1/__thread_support.h which triggers this warning.

Test Plan
  • world builds fail on amd64 (and other archs) in libdevdctl when building with both GCC 6 and GCC 9 and get farther now (though my gcc amd64 world still hasn't successfully completed)

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33270
Build 30599: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Aug 31 2020, 8:39 PM

Fine with me. Does this come about because of some #ifdef use etc.?

This revision is now accepted and ready to land.Aug 31 2020, 8:41 PM

This is fine. I understood there are some libc++ headers that do just ; as the body for something, and that triggers it.

Yes, in this case it is line 295 of the header I referenced:

inline _LIBCPP_INLINE_VISIBILITY
bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) const
{
    if(__elapsed > chrono::milliseconds(128))
        __libcpp_thread_sleep_for(chrono::milliseconds(8));
    else if(__elapsed > chrono::microseconds(64))
        __libcpp_thread_sleep_for(__elapsed / 2);
    else if(__elapsed > chrono::microseconds(4))
      __libcpp_thread_yield();
    else
      ; // poll
    return false;
}

The warning is for the `; // poll' line.

This revision was automatically updated to reflect the committed changes.