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)
Tue, Apr 29, 11:19 PM
Unknown Object (File)
Thu, Apr 24, 1:33 AM
Unknown Object (File)
Mon, Apr 14, 10:42 AM
Unknown Object (File)
Mon, Apr 14, 3:54 AM
Unknown Object (File)
Sun, Apr 13, 11:47 PM
Unknown Object (File)
Sun, Apr 13, 11:28 PM
Unknown Object (File)
Apr 7 2025, 1:34 PM
Unknown Object (File)
Apr 5 2025, 10:58 PM
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

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

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.