diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-02-09 11:51:08 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-02-09 11:59:17 +0100 |
commit | 2bb4556220285e92e599635c61029f25e9ca5e28 (patch) | |
tree | 6608ce378ac4c7833c3e5f0c27a45c297ecfa9d7 /gcc/expr.cc | |
parent | 0a329ecf1137366b2ec4bf7c2b977e817fdcf0fc (diff) | |
download | gcc-2bb4556220285e92e599635c61029f25e9ca5e28.zip gcc-2bb4556220285e92e599635c61029f25e9ca5e28.tar.gz gcc-2bb4556220285e92e599635c61029f25e9ca5e28.tar.bz2 |
hwint: Introduce HOST_SIZE_T_PRINT_*
build_conflict_bit_table uses %ld format string for
(long) some_int_expression * sizeof (something)
argument, that doesn't work on LLP64 hosts because the
expression has then size_t aka unsigned long long type there.
It can be fixed with
(long) (some_int_expression * sizeof (something))
but it means the value is truncated if it doesn't fit into long.
Ideally we'd use %zd or %zu modifiers here, but it is unclear if we
can rely on it on all hosts, it has been introduced in C99 and C++11
includes C99 by reference, but in reality whether this works or not
depends on the host C library and some of them are helplessly obsolete.
This patch instead introduces new macros HOST_SIZE_T_PRINT_* which
one can use in *printf family function format strings and cast to
fmt_size_t type.
2024-02-09 Jakub Jelinek <jakub@redhat.com>
* hwint.h (GCC_PRISZ, fmt_size_t, HOST_SIZE_T_PRINT_DEC,
HOST_SIZE_T_PRINT_UNSIGNED, HOST_SIZE_T_PRINT_HEX,
HOST_SIZE_T_PRINT_HEX_PURE): Define.
* ira-conflicts.cc (build_conflict_bit_table): Use it. Formatting
fixes.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions