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

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 8 07:24:25 PST 2021


Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

FWIW, this seems fine to me because it's limited to `__support/ibm/` code.
However,
(1) In portable code (which this is not), `long` would be problematic because its size varies. The ranges of numbers expected here are known, because they're time units (like, "one century in microseconds" fits comfortably in `int64_t` but not in `int32_t`). So probably `int32_t` or `int64_t` would be easier to reason about. (But again, this code is non-portable by design, and I assume you know the size of `long` on your specific platform, and I also assume it's 64 bits.)
(2) It's odd to be changing the variable types //and// adding casts. For example, `__sec` is a `time_t` variable, but is invariably(?) used as an `unsigned int`. `__micro_sec` is a `long` variable, but is invariably used as an `unsigned int`. Why aren't these variables just declared as `unsigned int` then?


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