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 9, 9:40 PM
Unknown Object (File)
Jan 14 2024, 7:14 AM
Unknown Object (File)
Dec 20 2023, 6:41 AM
Unknown Object (File)
Dec 14 2023, 9:54 PM
Unknown Object (File)
Dec 7 2023, 12:17 PM
Unknown Object (File)
Oct 31 2023, 11:20 AM
Unknown Object (File)
Sep 10 2023, 3:11 PM
Unknown Object (File)
Aug 28 2023, 7:29 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.