[libcxx-commits] [PATCH] D112837: [SystemZ][z/OS] Fix warnings from unsigned int to long in 32-bit mode

Zibi Sarbino via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 8 14:28:46 PST 2021


zibi added a comment.

Thank you `Quuxplusone` for your review and approval.  Following is the rational of this patch.

This code was written for z/OS and as you indicated is not portable. The `long` was chosen to reduce number of cast statements. Currently we have 3 casts and with `uint_32_t` or `int64_t` we would have 5.

The root of the problem is the change of the signedness as the warning indicates and because `long` is a variant type on z/OS, 64-bit or 32-bit signed integer.

The type of `time_t` is `long` so as `tv_nsec`. The `tv_sec` is `time_t`.  Therefore, they are all `long`.
However, both `sleep() and usleep() take `unsinged int` as parameter.

`unsigned int sleep(unsigned int );`
`int usleep(useconds_t);  // seconds_t is unsinged int`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112837/new/

https://reviews.llvm.org/D112837



More information about the libcxx-commits mailing list