From: Dongkyun Son Date: Wed, 8 Jan 2020 19:43:14 +0000 (+0900) Subject: Handle glibc sys/sysctl.h deprecation (#27048) (#681) X-Git-Tag: submit/tizen_5.5/20200504.045052~11^2^2~180 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9e87b9b4cdbd0527a561e2b286f6dc7f7ca1d47;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Handle glibc sys/sysctl.h deprecation (#27048) (#681) glibc has deprecated sys/sysctl.h: In file included from /coreclr/src/pal/src/misc/sysinfo.cpp:32: /usr/include/sys/sysctl.h:21:2: error: "The header is deprecated and will be removed." [-Werror,-W#warnings] #warning "The header is deprecated and will be removed." ^ 1 error generated. Fix that by preferring sysconf and only including sys/sysctl.h if HAVE_SYSCONF is not true. This mirrors the order of the implementation code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF before HAVE_SYSCTL. Fixes #27008 Co-authored-by: Omair Majid --- diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp index dd23c9cea..45b6b3bdb 100644 --- a/src/pal/src/misc/sysinfo.cpp +++ b/src/pal/src/misc/sysinfo.cpp @@ -26,9 +26,12 @@ Revision History: #include #include #include -#if HAVE_SYSCTL + +#if HAVE_SYSCONF +// already included above +#elif HAVE_SYSCTL #include -#elif !HAVE_SYSCONF +#else #error Either sysctl or sysconf is required for GetSystemInfo. #endif