linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Silence some clang -Wshorten-64-to-32 warnings
@ 2025-04-30 17:15 Ian Rogers
  2025-04-30 17:15 ` [PATCH v2 1/5] bitfield: Silence a clang -Wshorten-64-to-32 warning Ian Rogers
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Ian Rogers @ 2025-04-30 17:15 UTC (permalink / raw)
  To: Yury Norov, Rasmus Villemoes, Arnd Bergmann, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Ian Rogers,
	Adrian Hunter, Thomas Gleixner, Jakub Kicinski, Jacob Keller,
	linux-arch, linux-kernel, llvm, Leo Yan

Clang's shorten-64-to-32 can be useful to spot certain kinds of bugs
that can be more prevalent in C code due to implicit 64 to 32-bit
casting. Add some explicit casts to header files so as to avoid the
warning when these headers are used.

This patch started out as a single patch in a series for the perf tool
where a bug could have been identified were -Wshorten-64-to-32
enabled:
https://lore.kernel.org/lkml/20250401182347.3422199-3-irogers@google.com/

v2: Rebase and try to address Arnd Bergmann's comments wrt the commit
    message. Arnd also mentioned doing larger refactors, changing
    return types and adding helper functions. I've held off doing this
    given concerns over breaking printf flags.

Ian Rogers (5):
  bitfield: Silence a clang -Wshorten-64-to-32 warning
  bitmap: Silence a clang -Wshorten-64-to-32 warning
  bitops: Silence a clang -Wshorten-64-to-32 warning
  math64: Silence a clang -Wshorten-64-to-32 warning
  hash.h: Silence a clang -Wshorten-64-to-32 warning

 include/asm-generic/bitops/fls64.h | 2 +-
 include/linux/bitfield.h           | 2 +-
 include/linux/bitmap.h             | 2 +-
 include/linux/hash.h               | 2 +-
 include/linux/math64.h             | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.49.0.906.g1f30a19c02-goog


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-05-07  8:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30 17:15 [PATCH v2 0/5] Silence some clang -Wshorten-64-to-32 warnings Ian Rogers
2025-04-30 17:15 ` [PATCH v2 1/5] bitfield: Silence a clang -Wshorten-64-to-32 warning Ian Rogers
2025-05-03 10:33   ` David Laight
2025-05-07  8:38   ` kernel test robot
2025-04-30 17:15 ` [PATCH v2 2/5] bitmap: " Ian Rogers
2025-05-02 16:03   ` Yury Norov
2025-05-02 16:43     ` Ian Rogers
2025-05-02 16:55       ` Yury Norov
2025-05-02 17:13         ` Ian Rogers
2025-04-30 17:15 ` [PATCH v2 3/5] bitops: " Ian Rogers
2025-04-30 17:15 ` [PATCH v2 4/5] math64: " Ian Rogers
2025-05-01 20:07   ` David Laight
2025-05-01 20:15     ` Ian Rogers
2025-05-01 20:26       ` David Laight
2025-05-01 21:11         ` Ian Rogers
2025-05-02 12:17           ` David Laight
2025-04-30 17:15 ` [PATCH v2 5/5] hash.h: " Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).