Fix build errors using GCC 11 (#46334)
authorOmair Majid <omajid@redhat.com>
Tue, 5 Jan 2021 23:50:18 +0000 (18:50 -0500)
committerGitHub <noreply@github.com>
Tue, 5 Jan 2021 23:50:18 +0000 (15:50 -0800)
commitf473665b470a5e23bb161e465b9b8427cbccb466
treef89a10b69044c1085ecd966ef6f03d2975fa5d65
parent15eabd92525b5333f46dd1e13047d1024a9b45b5
Fix build errors using GCC 11 (#46334)

Building runtime with GCC 11 leads to some new errors. The errors are
consistent with the "Header dependency changes" section documented at
https://gcc.gnu.org/gcc-11/porting_to.html

The first set of errors looks like this:

    runtime/src/coreclr/pal/src/misc/cgroup.cpp:403:29:
    error: no member named 'numeric_limits' in namespace 'std'
              if (temp > std::numeric_limits<size_t>::max())
                         ~~~~~^

Fix that by including <limits>.

The second set of errors looks like this:

    runtime/src/installer/corehost/cli/test/nativehost/host_context_test.cpp:634:31:
     error: no member named 'sleep_for' in namespace 'std::this_thread'
              std::this_thread::sleep_for(std::chrono::milliseconds(100));
              ~~~~~~~~~~~~~~~~~~^

Fix that by including <thread>.
src/coreclr/pal/src/misc/cgroup.cpp
src/installer/corehost/cli/test/nativehost/host_context_test.cpp