forked from OSchip/llvm-project
422cf2b506
This patch fixes the warnings which shows up when libcxx library started to be compiled in 32-bit mode on z/OS. More specifically, the assignment from unsigned int to time_t aka long was flags as follows: ``` libcxx/include/c++/v1/__support/ibm/nanosleep.h:31:11: warning: implicit conversion changes signedness: 'unsigned int' to 'time_t' (aka 'long') [-Wsign-conversion] __sec = sleep(static_cast<unsigned int>(__sec)); ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libcxx/include/c++/v1/__support/ibm/nanosleep.h:36:36: warning: implicit conversion changes signedness: 'unsigned int' to 'long' [-Wsign-conversion] __rem->tv_nsec = __micro_sec * 1000; ~ ~~~~~~~~~~~~^~~~~~ libcxx/include/c++/v1/__support/ibm/nanosleep.h:47:36: warning: implicit conversion changes signedness: 'unsigned int' to 'long' [-Wsign-conversion] __rem->tv_nsec = __micro_sec * 1000; ~ ~~~~~~~~~~~~^~~~~~ 3 warnings generated. ``` Here is a small test case illustrating the issue: ``` typedef long time_t ; unsigned int sleep(unsigned int ); int main() { time_t sec = 0; #ifdef FIX sec = static_cast<time_t>(sleep(static_cast<unsigned int>(sec))); #else sec = sleep(static_cast<unsigned int>(sec)); #endif } ``` clang++ -c -Wsign-conversion -m32 t.C ``` t.C:8:9: warning: implicit conversion changes signedness: 'unsigned int' to 'time_t' (aka 'long') [-Wsign-conversion] sec = sleep(static_cast<unsigned int>(sec)); ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reviewed By: ldionne, #libc, Quuxplusone, Mordante Differential Revision: https://reviews.llvm.org/D112837 |
||
---|---|---|
.. | ||
android | ||
fuchsia | ||
ibm | ||
musl | ||
newlib | ||
openbsd | ||
solaris | ||
win32 | ||
xlocale |