Skip to content

Commit d1957d2

Browse files
ViralBShahclaude
andcommitted
ci: fix strict-warnings on gcc-13/clang-18 and cross regression build
The strict lane surfaced more on the CI compilers than on older local ones (verified against gcc 13 / clang 18): * gcc: zero-init nadj in the float lgammaf_r too (same guarded false-positive as the double/long-double versions). * clang 18 renamed the int->float conversion diagnostic to -Wimplicit-const-int-float-conversion; suppress that spelling as well. * clang: suppress -Wdeprecated-non-prototype (C23) for the lane; the K&R definitions in w_cabs*.c and bsdsrc/b_*.c are left for a focused prototype-conversion follow-up. Cross CI: build the regression programs with the cross toolchain in the "Build tests" step and pass the toolchain vars to the qemu run, so the foreign-arch regression binaries are produced by $TRIPLE-gcc instead of the host compiler. Verified locally by cross-building for riscv64 and running the regression test under qemu. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 304b96b commit d1957d2

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

.github/workflows/cross.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ jobs:
5757
- name: Build with ${{ matrix.config.triple }}-gcc
5858
run: make -j$(nproc) ARCH=$ARCH TOOLPREFIX=$TRIPLE- ${CC:+CC=$CC} ${AR:+AR=$AR}
5959
- name: Build tests
60-
run: make -j$(nproc) -C test ARCH=$ARCH TOOLPREFIX=$TRIPLE- ${CC:+CC=$CC} ${AR:+AR=$AR}
60+
# Build the regression programs with the cross toolchain too, so the
61+
# run step below only executes them (under qemu) rather than trying to
62+
# rebuild them with the host compiler.
63+
run: make -j$(nproc) -C test all regression-build ARCH=$ARCH TOOLPREFIX=$TRIPLE- ${CC:+CC=$CC} ${AR:+AR=$AR}
6164
- name: Run tests under qemu
6265
env:
6366
QEMU_LD_PREFIX: /usr/${{ matrix.config.triple }}
6467
LD_LIBRARY_PATH: .
65-
run: make test
68+
run: make test ARCH=$ARCH TOOLPREFIX=$TRIPLE- ${CC:+CC=$CC} ${AR:+AR=$AR}

Make.inc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,21 @@ CFLAGS_add += -std=c99 -Wall -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(O
165165
WERROR ?= 0
166166
ifeq ($(WERROR),1)
167167
CFLAGS_add += -Werror
168-
# Two clang-only diagnostics are silenced for the strict lane (gcc ignores
168+
# A few clang-only diagnostics are silenced for the strict lane (gcc ignores
169169
# unknown -Wno-* options, so this is safe for both compilers):
170-
# * -Wimplicit-int-float-conversion: s_lround/s_llround deliberately round
171-
# DTYPE_MAX through (dtype)x; the boundary arithmetic is correct by design.
170+
# * -Wimplicit-int-float-conversion / -Wimplicit-const-int-float-conversion:
171+
# s_lround/s_llround deliberately round DTYPE_MAX through (dtype)x; the
172+
# boundary arithmetic is correct by design. (clang renamed the const form
173+
# around clang 18, so both spellings are listed.)
172174
# * -Wignored-attributes: the extern-inline fenv re-declarations in
173-
# openlibm_fenv_*.h trip a harmless attribute-placement diagnostic; tracked
174-
# separately rather than reworked under the warnings sweep.
175-
CFLAGS_add += -Wno-implicit-int-float-conversion -Wno-ignored-attributes
175+
# openlibm_fenv_*.h trip a harmless attribute-placement diagnostic.
176+
# * -Wdeprecated-non-prototype: a handful of old K&R-style definitions
177+
# (w_cabs*.c, bsdsrc/b_*.c) that C23 deprecates; converting them to ANSI
178+
# prototypes is left to a focused follow-up rather than this CI change.
179+
CFLAGS_add += -Wno-implicit-int-float-conversion \
180+
-Wno-implicit-const-int-float-conversion \
181+
-Wno-ignored-attributes \
182+
-Wno-deprecated-non-prototype
176183
endif
177184
ifneq ($(filter $(ARCH),i387 amd64 powerpc),)
178185
CFLAGS_add += -I$(OPENLIBM_HOME)/ld80

src/e_lgammaf_r.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
141141
float t,y,z,nadj,p,p1,p2,p3,q,r,w;
142142
int32_t hx;
143143
int i,ix;
144+
nadj = 0; /* only set & used when hx<0; init silences -Wmaybe-uninitialized */
144145

145146
GET_FLOAT_WORD(hx,x);
146147

0 commit comments

Comments
 (0)