D112012 broke the Solaris buildbots (sparcv9 and amd64:
/vol/llvm/src/llvm-project/local/third-party/benchmark/src/sysinfo.cc:447:2: error: #warning is a language extension [-Werror,-Wpedantic] #warning "HOST_NAME_MAX not defined. using 64" ^ /vol/llvm/src/llvm-project/local/third-party/benchmark/src/sysinfo.cc:447:2: error: "HOST_NAME_MAX not defined. using 64" [-Werror,-W#warnings] /vol/llvm/src/llvm-project/local/third-party/benchmark/src/sysinfo.cc:475:16: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32] int NumCPU = sysconf(_SC_NPROCESSORS_ONLN); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vol/llvm/src/llvm-project/local/third-party/benchmark/src/sysinfo.cc:653:42: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual] kstat_t *ksp = kstat_lookup(kc, (char*)"cpu_info", -1, (char*)"cpu_info0"); ^ /vol/llvm/src/llvm-project/local/third-party/benchmark/src/sysinfo.cc:653:65: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual] kstat_t *ksp = kstat_lookup(kc, (char*)"cpu_info", -1, (char*)"cpu_info0"); ^ /vol/llvm/src/llvm-project/local/third-party/benchmark/src/sysinfo.cc:663:53: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual] (kstat_named_t*)kstat_data_lookup(ksp, (char*)"current_clock_Hz"); ^
- Solaris uses MAXHOSTNAMELEN which, contrary to gethostname(3C) lives in <netdb.h>, not <unistd.h>`.
- sysconf returns long, not int, so account for that
- kstat_lookup etc. need const_casts
Tested on amd64-pc-solaris2.11.