PR #25533 opened by Kilian (lusoris)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25533
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25533.patch

This patch removes three macro redefinition warnings in 
tests/checkasm/snowdsp.c that gcc 15.2 reports with -march=x86-64-v3 (POPCNT 
and BMI2 enabled):

```
libavutil/x86/intmath.h:75:13: warning: 'av_popcount' redefined
libavutil/x86/intmath.h:77:13: warning: 'av_popcount64' redefined
libavutil/x86/intmath.h:93:9: warning: 'av_zero_extend' redefined
```

Cause: checkasm objects are built without HAVE_AV_CONFIG_H. snowdsp.c includes 
snow.h first, which reaches common.h through avcodec.h and installs the generic 
aliases; the later rangecoder.h inclusion reaches x86/intmath.h, which defines 
them again.

What the patch does: `checkasm/snowdsp: Include intmath before public headers` 
includes libavutil/intmath.h first, so common.h sees the chosen 
implementations. Only this test file changes; the other checkasm objects and 
the architecture header stay as they are.

Behaviour change: none; the test builds the same code.

Base: FFmpeg master 86444dd368.

Testing, in an ubuntu:26.04 container whose amd64v3 package variant builds gcc 
15.2.0-16ubuntu1 with -march=x86-64-v3 by default (`--fatal-warnings 
--enable-version3 --disable-indevs`, targets build and checkasm):

- master 86444dd368 shows 108 warnings; with this patch and the three sibling 
pull requests (one per area: checkasm/snowdsp, aom_film_grain, 
vvc/intra_template, wmalosslessdec) it shows 91, the 17 removed are exactly the 
ones listed in each pull request and no new warning appears.
- FATE on that build with all four patches: fate-vvc (38 tests), 
fate-lossless-wmall (4), fate-film_grain_params, fate-checkasm (including 
checkasm-snowdsp) and fate-cbs-av1 for both av1-1-b8/b10-23-film_grain-50 
samples, 143 tests in all, pass.



>From d763deabc246ae3f14c6cc2a765ce8e641bb7578 Mon Sep 17 00:00:00 2001
From: lusoris <[email protected]>
Date: Tue, 27 Oct 2026 17:06:28 +0100
Subject: [PATCH] checkasm/snowdsp: Include intmath before public headers

Checkasm objects are built without HAVE_AV_CONFIG_H. Including snow.h
first reaches common.h through avcodec.h, which installs the generic
av_popcount, av_popcount64 and av_zero_extend aliases. The later
rangecoder.h inclusion reaches x86/intmath.h and redefines them when
POPCNT and BMI2 are enabled.

Include intmath.h before the public headers so common.h sees the chosen
implementations. This fixes the redefinition warnings reported with gcc
15.2 with -march=x86-64-v3 without changing all checkasm objects or
making the architecture header retain the generic fallbacks.

Signed-off-by: lusoris <[email protected]>
---
 tests/checkasm/snowdsp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/checkasm/snowdsp.c b/tests/checkasm/snowdsp.c
index 99cfae679e2..aa031e4d851 100644
--- a/tests/checkasm/snowdsp.c
+++ b/tests/checkasm/snowdsp.c
@@ -21,6 +21,7 @@
 #include <stdint.h>
 #include <string.h>
 
+#include "libavutil/intmath.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/macros.h"
 #include "libavutil/mem_internal.h"
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to