mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Fix the x86 defconfig build with GCC 17
@ 2026-11-04 16:07 Vineet Gupta
  2026-11-04 16:07 ` [PATCH 1/4] x86/cpufeatures: Make {REQUIRED,DISABLED}_MASK_BIT_SET() return 0 or 1 Vineet Gupta
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Vineet Gupta @ 2026-11-04 16:07 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Peter Zijlstra, Juri Lelli, Vincent Guittot, Joerg Roedel (AMD),
	Will Deacon, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Tvrtko Ursulin, David Airlie, Simona Vetter, Matthew Brost,
	Thomas Hellström
  Cc: Vineet Gupta, H. Peter Anvin, Xin Li (Intel),
	Brian Gerst, Nikolay Borisov, linux-kernel, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
	K Prateek Nayak, Robin Murphy, iommu, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, intel-gfx,
	dri-devel, intel-xe, llvm

Fix build warnings and failures (CONFIG_WERROR=y) with a GCC 17 build.
GCC 17 adds -Wconstant-logical-operand which is strict about operands
of && or || that fold to a constant other than 0 or 1.

In the past similar fixes have been done for clang, e.g.

  93f56de25937 2017-04-06 mac80211: Fix clang warning about constant operand in logical operation  [v4.12-rc1]
  ...
  dd7fe5d9fd6a 2024-01-17 rtc: max31335: Fix comparison in max31335_volatile_reg()                 [v6.8-rc1]

The reason this trips only with gcc is that clang's toggle is more
permissive:
 - it checks RHS only, not constant LHS.
 - Macros are not checked.

Fix is to effectively make a macro or condition return 0 or 1.

The patches are split up per subsystem and can go independently via
respective trees:

  1/4 x86/cpufeatures: the awk-generated *_MASK_BIT_SET() returns 0 or 1.
  2/4 wait: ___wait_is_interruptible() with a constant state.
  3/4 iommupt: PT_SUPPORTED_FEATURE() in the fvalog2_*() helpers.
  4/4 drm/i915: IS_POWER_OF_2() in reg_bits.h, and two Kconfig timeouts.

Tested on x86 defconfig with CONFIG_WERROR=y, at each patch:

 - GCC 17 trunk (20261103): each patch removes only its own errors. The
   build has no warnings after 4/4.
 - GCC 16.1: the build has no warnings. The .text of each object file
   does not change. The only differences come from the build timestamp
   and the release string.

Vineet Gupta (4):
  x86/cpufeatures: Make {REQUIRED,DISABLED}_MASK_BIT_SET() return 0 or 1
  wait: Make ___wait_is_interruptible() return 0 or 1
  iommupt: Make PT_SUPPORTED_FEATURE() return 0 or 1
  drm/i915: Avoid -Wconstant-logical-operand with GCC 17

 arch/x86/tools/cpufeaturemasks.awk          | 4 ++--
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 +-
 drivers/gpu/drm/i915/i915_config.c          | 2 +-
 drivers/iommu/generic_pt/pt_defs.h          | 2 +-
 include/drm/intel/reg_bits.h                | 2 +-
 include/linux/wait.h                        | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.53.0-Meta


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

end of thread, other threads:[~2026-11-04 21:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 16:07 [PATCH 0/4] Fix the x86 defconfig build with GCC 17 Vineet Gupta
2026-11-04 16:07 ` [PATCH 1/4] x86/cpufeatures: Make {REQUIRED,DISABLED}_MASK_BIT_SET() return 0 or 1 Vineet Gupta
2026-11-04 16:07 ` [PATCH 2/4] wait: Make ___wait_is_interruptible() " Vineet Gupta
2026-11-04 16:07 ` [PATCH 3/4] iommupt: Make PT_SUPPORTED_FEATURE() " Vineet Gupta
2026-11-04 16:07 ` [PATCH 4/4] drm/i915: Avoid -Wconstant-logical-operand with GCC 17 Vineet Gupta
2026-11-04 16:27 ` [PATCH 0/4] Fix the x86 defconfig build " Borislav Petkov
2026-11-04 18:05   ` Vineet Gupta
2026-11-04 21:18     ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®