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, Dec 10, 7:26 AM
Unknown Object (File)
Nov 14 2024, 2:58 AM
Unknown Object (File)
Oct 21 2024, 4:12 AM
Unknown Object (File)
Oct 21 2024, 4:12 AM
Unknown Object (File)
Oct 21 2024, 4:11 AM
Unknown Object (File)
Oct 21 2024, 3:49 AM
Unknown Object (File)
Sep 6 2024, 9:00 AM
Unknown Object (File)
Sep 4 2024, 10:59 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.