Fix the x86 defconfig build with GCC 17
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 6 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | x86/cpufeatures: Make {REQUIRED,DISABLED}_MASK_BIT_SET() return 0 or 1arch/ | +2 | 0 replies | |
| 2/4 | wait: Make ___wait_is_interruptible() return 0 or 1include/ | +1 | 2 replies | |
| 3/4 | iommupt: Make PT_SUPPORTED_FEATURE() return 0 or 1drivers/ | +1 | 0 replies | |
| 4/4 | drm/i915: Avoid -Wconstant-logical-operand with GCC 17drivers/ drivers/ include/ | +3 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/4] Fix the x86 defconfig build with GCC 17
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(-)
Signature · 1 line
2.53.0-Meta