* [FFmpeg-devel] [PATCH] avutil/attributes: use standard attributes when they are available (PR #20608)
@ 2025-09-25 18:06 Kacper Michajłow via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Kacper Michajłow via ffmpeg-devel @ 2025-09-25 18:06 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Kacper Michajłow
PR #20608 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20608
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20608.patch
From 08b798dd52b743221bc3023fbff3db4fc8925156 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Thu, 25 Sep 2025 19:31:17 +0200
Subject: [PATCH 1/4] ALL: move av_unused to conform with standard requirement
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is required placement by standard [[maybe_unused]] attribute, works
the same for __attribute__((unused)).
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
compat/w32pthreads.h | 8 ++--
fftools/opt_common.c | 2 +-
libavcodec/aacpsy.c | 2 +-
libavcodec/cabac_functions.h | 10 ++---
libavcodec/cbs_av1.c | 2 +-
libavcodec/dvbsubdec.c | 2 +-
libavcodec/flacenc.c | 2 +-
libavcodec/get_bits.h | 2 +-
libavcodec/h264_mvpred.h | 2 +-
libavcodec/h264pred_template.c | 36 ++++++++--------
libavcodec/h264qpel_template.c | 6 +--
libavcodec/hqxvlc.h | 2 +-
libavcodec/jpeg2000dec.c | 2 +-
libavcodec/libaomenc.c | 4 +-
libavcodec/libsvtav1.c | 2 +-
libavcodec/mips/vp8dsp_mmi.c | 60 +++++++++++++--------------
libavcodec/motion_est_template.c | 10 ++---
libavcodec/pcm.c | 10 ++---
libavcodec/put_bits.h | 2 +-
libavcodec/v210dec_init.h | 2 +-
libavcodec/v210enc_init.h | 2 +-
libavcodec/vp56.h | 2 +-
libavcodec/vp89_rac.h | 2 +-
libavcodec/vp8dsp.c | 16 +++----
libavcodec/wmalosslessdec.c | 2 +-
libavcodec/x86/h264_qpel.c | 2 +-
libavfilter/af_afirdsp.h | 2 +-
libavfilter/vf_blend_init.h | 2 +-
libavfilter/vf_curves.c | 2 +-
libavfilter/vf_dnn_detect.c | 2 +-
libavfilter/vf_eq.h | 2 +-
libavfilter/vf_gblur_init.h | 2 +-
libavfilter/vf_hflip_init.h | 2 +-
libavfilter/vf_nlmeans_init.h | 2 +-
libavfilter/vf_threshold_init.h | 2 +-
libavfilter/vsrc_testsrc.c | 2 +-
libavformat/asfdec_f.c | 2 +-
libavformat/asfdec_o.c | 2 +-
libavformat/flacdec.c | 2 +-
libavformat/flvdec.c | 2 +-
libavformat/framecrcenc.c | 2 +-
libavformat/id3v2.c | 2 +-
libavformat/matroskadec.c | 2 +-
libavformat/matroskaenc.c | 2 +-
libavformat/mp3enc.c | 2 +-
libavformat/mpegts.c | 2 +-
libavformat/nsvdec.c | 4 +-
libavformat/r3d.c | 8 ++--
libavformat/rtpdec.c | 2 +-
libavformat/rtspcodes.h | 2 +-
libavutil/eval.c | 2 +-
libavutil/hwcontext_opencl.c | 2 +-
libavutil/ripemd.c | 8 ++--
libavutil/softfloat.h | 2 +-
libswresample/swresample.c | 2 +-
libswresample/x86/resample_init.c | 2 +-
libswscale/loongarch/yuv2rgb_lasx.c | 2 +-
libswscale/loongarch/yuv2rgb_lsx.c | 8 ++--
libswscale/ppc/swscale_ppc_template.c | 2 +-
libswscale/x86/swscale.c | 2 +-
libswscale/yuv2rgb.c | 18 ++++----
tests/checkasm/checkasm.h | 2 +-
62 files changed, 151 insertions(+), 151 deletions(-)
diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index 61f3dfcdd9..f689d04d51 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -72,7 +72,7 @@ typedef CONDITION_VARIABLE pthread_cond_t;
#define THREADFUNC_RETTYPE unsigned
#endif
-static av_unused THREADFUNC_RETTYPE
+av_unused static THREADFUNC_RETTYPE
__stdcall attribute_align_arg win32thread_worker(void *arg)
{
pthread_t h = (pthread_t)arg;
@@ -80,7 +80,7 @@ __stdcall attribute_align_arg win32thread_worker(void *arg)
return 0;
}
-static av_unused int pthread_create(pthread_t *thread, const void *unused_attr,
+av_unused static int pthread_create(pthread_t *thread, const void *unused_attr,
void *(*start_routine)(void*), void *arg)
{
pthread_t ret;
@@ -109,7 +109,7 @@ static av_unused int pthread_create(pthread_t *thread, const void *unused_attr,
return 0;
}
-static av_unused int pthread_join(pthread_t thread, void **value_ptr)
+av_unused static int pthread_join(pthread_t thread, void **value_ptr)
{
DWORD ret = WaitForSingleObject(thread->handle, INFINITE);
if (ret != WAIT_OBJECT_0) {
@@ -149,7 +149,7 @@ static inline int pthread_mutex_unlock(pthread_mutex_t *m)
typedef INIT_ONCE pthread_once_t;
#define PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT
-static av_unused int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
+av_unused static int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
{
BOOL pending = FALSE;
InitOnceBeginInitialize(once_control, 0, &pending, NULL);
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index e217456be7..2c1f956551 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -992,7 +992,7 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
#endif
while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
- enum AVPixelFormat av_unused pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
+ av_unused enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
printf("%c%c%c%c%c %-16s %d %3d %d",
sws_isSupportedInput (pix_fmt) ? 'I' : '.',
sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index ed03cb68ac..7a9c2ce6ad 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -402,7 +402,7 @@ static const uint8_t window_grouping[9] = {
* Tell encoder which window types to use.
* @see 3GPP TS26.403 5.4.1 "Blockswitching"
*/
-static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
+av_unused static FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
const int16_t *audio,
const int16_t *la,
int channel, int prev_type)
diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h
index c3f08d3410..6a2e9ceca5 100644
--- a/libavcodec/cabac_functions.h
+++ b/libavcodec/cabac_functions.h
@@ -137,16 +137,16 @@ static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const st
}
#endif
-static int av_noinline av_unused get_cabac_noinline(CABACContext *c, uint8_t * const state){
+av_unused av_noinline static int get_cabac_noinline(CABACContext *c, uint8_t * const state){
return get_cabac_inline(c,state);
}
-static int av_unused get_cabac(CABACContext *c, uint8_t * const state){
+av_unused static int get_cabac(CABACContext *c, uint8_t * const state){
return get_cabac_inline(c,state);
}
#ifndef get_cabac_bypass
-static int av_unused get_cabac_bypass(CABACContext *c){
+av_unused static int get_cabac_bypass(CABACContext *c){
int range;
c->low += c->low;
@@ -184,7 +184,7 @@ static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
* @return the number of bytes read or 0 if no end
*/
#ifndef get_cabac_terminate
-static int av_unused get_cabac_terminate(CABACContext *c){
+av_unused static int get_cabac_terminate(CABACContext *c){
c->range -= 2;
if(c->low < c->range<<(CABAC_BITS+1)){
renorm_cabac_decoder_once(c);
@@ -200,7 +200,7 @@ static int av_unused get_cabac_terminate(CABACContext *c){
* @return the address of the first skipped byte or NULL if there's less than @p n bytes left
*/
#ifndef skip_bytes
-static av_unused const uint8_t* skip_bytes(CABACContext *c, int n) {
+av_unused static const uint8_t* skip_bytes(CABACContext *c, int n) {
const uint8_t *ptr = c->bytestream;
if (c->low & 0x1)
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index f0021eff61..90e29ed0d8 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -462,7 +462,7 @@ static int cbs_av1_get_relative_dist(const AV1RawSequenceHeader *seq,
return diff;
}
-static av_unused size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc)
+av_unused static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc)
{
GetBitContext tmp = *gbc;
size_t size = 0;
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 9ecd96df86..db8a9d1eb1 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1154,7 +1154,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
const uint8_t *buf_end = buf + buf_size;
int region_id, object_id;
- int av_unused version;
+ av_unused int version;
DVBSubRegion *region;
DVBSubObject *object;
DVBSubObjectDisplay *display;
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index c6b9eb437a..48478749d9 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -1172,7 +1172,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
static int count_frame_header(FlacEncodeContext *s)
{
- uint8_t av_unused tmp;
+ av_unused uint8_t tmp;
int count;
/*
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 80a77f0ae3..85c87c65b1 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -168,7 +168,7 @@ static inline unsigned int show_bits(GetBitContext *s, int n);
#define OPEN_READER_NOSIZE(name, gb) \
unsigned int name ## _index = (gb)->index; \
- unsigned int av_unused name ## _cache
+ av_unused unsigned int name ## _cache
#if UNCHECKED_BITSTREAM_READER
#define OPEN_READER(name, gb) OPEN_READER_NOSIZE(name, gb)
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index bc9fef50e4..1fa5487322 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -931,7 +931,7 @@ static void fill_decode_caches(const H264Context *h, H264SliceContext *sl, int m
/**
* decodes a P_SKIP or B_SKIP macroblock
*/
-static void av_unused decode_mb_skip(const H264Context *h, H264SliceContext *sl)
+av_unused static void decode_mb_skip(const H264Context *h, H264SliceContext *sl)
{
const int mb_xy = sl->mb_xy;
int mb_type = 0;
diff --git a/libavcodec/h264pred_template.c b/libavcodec/h264pred_template.c
index 98b28d0afb..face13f7c7 100644
--- a/libavcodec/h264pred_template.c
+++ b/libavcodec/h264pred_template.c
@@ -113,28 +113,28 @@ static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const uint8_t *topright,
#define LOAD_TOP_RIGHT_EDGE\
- const unsigned av_unused t4 = topright[0];\
- const unsigned av_unused t5 = topright[1];\
- const unsigned av_unused t6 = topright[2];\
- const unsigned av_unused t7 = topright[3];\
+ av_unused const unsigned t4 = topright[0];\
+ av_unused const unsigned t5 = topright[1];\
+ av_unused const unsigned t6 = topright[2];\
+ av_unused const unsigned t7 = topright[3];\
#define LOAD_DOWN_LEFT_EDGE\
- const unsigned av_unused l4 = src[-1+4*stride];\
- const unsigned av_unused l5 = src[-1+5*stride];\
- const unsigned av_unused l6 = src[-1+6*stride];\
- const unsigned av_unused l7 = src[-1+7*stride];\
+ av_unused const unsigned l4 = src[-1+4*stride];\
+ av_unused const unsigned l5 = src[-1+5*stride];\
+ av_unused const unsigned l6 = src[-1+6*stride];\
+ av_unused const unsigned l7 = src[-1+7*stride];\
#define LOAD_LEFT_EDGE\
- const unsigned av_unused l0 = src[-1+0*stride];\
- const unsigned av_unused l1 = src[-1+1*stride];\
- const unsigned av_unused l2 = src[-1+2*stride];\
- const unsigned av_unused l3 = src[-1+3*stride];\
+ av_unused const unsigned l0 = src[-1+0*stride];\
+ av_unused const unsigned l1 = src[-1+1*stride];\
+ av_unused const unsigned l2 = src[-1+2*stride];\
+ av_unused const unsigned l3 = src[-1+3*stride];\
#define LOAD_TOP_EDGE\
- const unsigned av_unused t0 = src[ 0-1*stride];\
- const unsigned av_unused t1 = src[ 1-1*stride];\
- const unsigned av_unused t2 = src[ 2-1*stride];\
- const unsigned av_unused t3 = src[ 3-1*stride];\
+ av_unused const unsigned t0 = src[ 0-1*stride];\
+ av_unused const unsigned t1 = src[ 1-1*stride];\
+ av_unused const unsigned t2 = src[ 2-1*stride];\
+ av_unused const unsigned t3 = src[ 3-1*stride];\
static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright,
ptrdiff_t _stride)
@@ -826,7 +826,7 @@ static void FUNCC(pred8x16_plane)(uint8_t *_src, ptrdiff_t _stride)
const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \
+ 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \
PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) \
- const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2
+ av_unused const int l7 = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2
#define PT(x) \
const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2;
@@ -834,7 +834,7 @@ static void FUNCC(pred8x16_plane)(uint8_t *_src, ptrdiff_t _stride)
const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \
+ 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \
PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) \
- const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \
+ av_unused const int t7 = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \
+ 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2
#define PTR(x) \
diff --git a/libavcodec/h264qpel_template.c b/libavcodec/h264qpel_template.c
index 324a0889e9..b71710e6db 100644
--- a/libavcodec/h264qpel_template.c
+++ b/libavcodec/h264qpel_template.c
@@ -75,7 +75,7 @@ static inline void FUNC(copy_block16)(uint8_t *dst, const uint8_t *restrict src,
}
#define H264_LOWPASS(OPNAME, OP, OP2) \
-static av_unused void FUNC(OPNAME ## h264_qpel2_h_lowpass)(uint8_t *p_dst, const uint8_t *restrict p_src, int dstStride, int srcStride)\
+av_unused static void FUNC(OPNAME ## h264_qpel2_h_lowpass)(uint8_t *p_dst, const uint8_t *restrict p_src, int dstStride, int srcStride)\
{\
const int h=2;\
int i;\
@@ -92,7 +92,7 @@ static av_unused void FUNC(OPNAME ## h264_qpel2_h_lowpass)(uint8_t *p_dst, const
}\
}\
\
-static av_unused void FUNC(OPNAME ## h264_qpel2_v_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
+av_unused static void FUNC(OPNAME ## h264_qpel2_v_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
{\
const int w=2;\
int i;\
@@ -116,7 +116,7 @@ static av_unused void FUNC(OPNAME ## h264_qpel2_v_lowpass)(uint8_t *_dst, const
}\
}\
\
-static av_unused void FUNC(OPNAME ## h264_qpel2_hv_lowpass)(uint8_t *_dst, pixeltmp *tmp, const uint8_t *restrict _src, int dstStride, int tmpStride, int srcStride)\
+av_unused static void FUNC(OPNAME ## h264_qpel2_hv_lowpass)(uint8_t *_dst, pixeltmp *tmp, const uint8_t *restrict _src, int dstStride, int tmpStride, int srcStride)\
{\
const int h=2;\
const int w=2;\
diff --git a/libavcodec/hqxvlc.h b/libavcodec/hqxvlc.h
index abf81f60ad..864a4b2dbd 100644
--- a/libavcodec/hqxvlc.h
+++ b/libavcodec/hqxvlc.h
@@ -1531,7 +1531,7 @@ static const VLCElem *dc_vlc[2];
name ## _vlc_bits, 2, 2, 0); \
} while (0)
-static av_cold av_unused void hqx_init_static(void)
+av_unused av_cold static void hqx_init_static(void)
{
VLCInitState state = VLC_INIT_STATE(cbp_vlc);
const uint8_t *lens = hqx_ac_lens;
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 221ba87305..5d1502fabb 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2781,7 +2781,7 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
int n = bytestream2_get_be16u(&s->g);
for (; n>0; n--) {
int cn = bytestream2_get_be16(&s->g);
- int av_unused typ = bytestream2_get_be16(&s->g);
+ av_unused int typ = bytestream2_get_be16(&s->g);
int asoc = bytestream2_get_be16(&s->g);
if (cn < 4 && asoc < 4)
s->cdef[cn] = asoc;
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 5d265a54d1..e9b15fd7bd 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -484,7 +484,7 @@ static int set_pix_fmt(AVCodecContext *avctx, aom_codec_caps_t codec_caps,
struct aom_codec_enc_cfg *enccfg, aom_codec_flags_t *flags,
aom_img_fmt_t *img_fmt)
{
- AOMContext av_unused *ctx = avctx->priv_data;
+ av_unused AOMContext *ctx = avctx->priv_data;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
enccfg->g_bit_depth = enccfg->g_input_bit_depth = desc->comp[0].depth;
switch (avctx->pix_fmt) {
@@ -1090,7 +1090,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
AVPacket *pkt)
{
AOMContext *ctx = avctx->priv_data;
- int av_unused pict_type;
+ av_unused int pict_type;
int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index c6a0ff90bc..4a249a0032 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -210,7 +210,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
{
SvtContext *svt_enc = avctx->priv_data;
const AVPixFmtDescriptor *desc;
- const AVDictionaryEntry av_unused *en = NULL;
+ av_unused const AVDictionaryEntry *en = NULL;
// Update param from options
if (svt_enc->enc_mode >= -1)
diff --git a/libavcodec/mips/vp8dsp_mmi.c b/libavcodec/mips/vp8dsp_mmi.c
index 8b518e9c49..6de405bfb5 100644
--- a/libavcodec/mips/vp8dsp_mmi.c
+++ b/libavcodec/mips/vp8dsp_mmi.c
@@ -669,10 +669,10 @@ static const uint8_t subpel_filters[7][6] = {
static av_always_inline void vp8_filter_common_is4tap(uint8_t *p,
ptrdiff_t stride)
{
- int av_unused p1 = p[-2 * stride];
- int av_unused p0 = p[-1 * stride];
- int av_unused q0 = p[ 0 * stride];
- int av_unused q1 = p[ 1 * stride];
+ av_unused int p1 = p[-2 * stride];
+ av_unused int p0 = p[-1 * stride];
+ av_unused int q0 = p[ 0 * stride];
+ av_unused int q1 = p[ 1 * stride];
int a, f1, f2;
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
@@ -694,10 +694,10 @@ static av_always_inline void vp8_filter_common_is4tap(uint8_t *p,
static av_always_inline void vp8_filter_common_isnot4tap(uint8_t *p,
ptrdiff_t stride)
{
- int av_unused p1 = p[-2 * stride];
- int av_unused p0 = p[-1 * stride];
- int av_unused q0 = p[ 0 * stride];
- int av_unused q1 = p[ 1 * stride];
+ av_unused int p1 = p[-2 * stride];
+ av_unused int p0 = p[-1 * stride];
+ av_unused int q0 = p[ 0 * stride];
+ av_unused int q1 = p[ 1 * stride];
int a, f1, f2;
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
@@ -721,20 +721,20 @@ static av_always_inline void vp8_filter_common_isnot4tap(uint8_t *p,
static av_always_inline int vp8_simple_limit(uint8_t *p, ptrdiff_t stride,
int flim)
{
- int av_unused p1 = p[-2 * stride];
- int av_unused p0 = p[-1 * stride];
- int av_unused q0 = p[ 0 * stride];
- int av_unused q1 = p[ 1 * stride];
+ av_unused int p1 = p[-2 * stride];
+ av_unused int p0 = p[-1 * stride];
+ av_unused int q0 = p[ 0 * stride];
+ av_unused int q1 = p[ 1 * stride];
return 2 * FFABS(p0 - q0) + (FFABS(p1 - q1) >> 1) <= flim;
}
static av_always_inline int hev(uint8_t *p, ptrdiff_t stride, int thresh)
{
- int av_unused p1 = p[-2 * stride];
- int av_unused p0 = p[-1 * stride];
- int av_unused q0 = p[ 0 * stride];
- int av_unused q1 = p[ 1 * stride];
+ av_unused int p1 = p[-2 * stride];
+ av_unused int p0 = p[-1 * stride];
+ av_unused int q0 = p[ 0 * stride];
+ av_unused int q1 = p[ 1 * stride];
return FFABS(p1 - p0) > thresh || FFABS(q1 - q0) > thresh;
}
@@ -744,12 +744,12 @@ static av_always_inline void filter_mbedge(uint8_t *p, ptrdiff_t stride)
int a0, a1, a2, w;
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
- int av_unused p2 = p[-3 * stride];
- int av_unused p1 = p[-2 * stride];
- int av_unused p0 = p[-1 * stride];
- int av_unused q0 = p[ 0 * stride];
- int av_unused q1 = p[ 1 * stride];
- int av_unused q2 = p[ 2 * stride];
+ av_unused int p2 = p[-3 * stride];
+ av_unused int p1 = p[-2 * stride];
+ av_unused int p0 = p[-1 * stride];
+ av_unused int q0 = p[ 0 * stride];
+ av_unused int q1 = p[ 1 * stride];
+ av_unused int q2 = p[ 2 * stride];
w = clip_int8(p1 - q1);
w = clip_int8(w + 3 * (q0 - p0));
@@ -769,14 +769,14 @@ static av_always_inline void filter_mbedge(uint8_t *p, ptrdiff_t stride)
static av_always_inline int vp8_normal_limit(uint8_t *p, ptrdiff_t stride,
int E, int I)
{
- int av_unused p3 = p[-4 * stride];
- int av_unused p2 = p[-3 * stride];
- int av_unused p1 = p[-2 * stride];
- int av_unused p0 = p[-1 * stride];
- int av_unused q0 = p[ 0 * stride];
- int av_unused q1 = p[ 1 * stride];
- int av_unused q2 = p[ 2 * stride];
- int av_unused q3 = p[ 3 * stride];
+ av_unused int p3 = p[-4 * stride];
+ av_unused int p2 = p[-3 * stride];
+ av_unused int p1 = p[-2 * stride];
+ av_unused int p0 = p[-1 * stride];
+ av_unused int q0 = p[ 0 * stride];
+ av_unused int q1 = p[ 1 * stride];
+ av_unused int q2 = p[ 2 * stride];
+ av_unused int q3 = p[ 3 * stride];
return vp8_simple_limit(p, stride, E) &&
FFABS(p3 - p2) <= I && FFABS(p2 - p1) <= I &&
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c
index aa669e0ee7..cf481e2c6f 100644
--- a/libavcodec/motion_est_template.c
+++ b/libavcodec/motion_est_template.c
@@ -29,11 +29,11 @@
//Let us hope gcc will remove the unused vars ...(gcc 3.2.2 seems to do it ...)
#define LOAD_COMMON\
- uint32_t av_unused * const score_map= c->score_map;\
- const int av_unused xmin= c->xmin;\
- const int av_unused ymin= c->ymin;\
- const int av_unused xmax= c->xmax;\
- const int av_unused ymax= c->ymax;\
+ av_unused uint32_t * const score_map= c->score_map;\
+ av_unused const int xmin= c->xmin;\
+ av_unused const int ymin= c->ymin;\
+ av_unused const int xmax= c->xmax;\
+ av_unused const int ymax= c->ymax;\
const uint8_t *mv_penalty = c->current_mv_penalty; \
const int pred_x= c->pred_x;\
const int pred_y= c->pred_y;\
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index ea3e66868d..157adc92d7 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -38,7 +38,7 @@
#include "encode.h"
#include "pcm_tablegen.h"
-static av_cold av_unused int pcm_encode_init(AVCodecContext *avctx)
+av_unused av_cold static int pcm_encode_init(AVCodecContext *avctx)
{
avctx->frame_size = 0;
#if !CONFIG_HARDCODED_TABLES
@@ -104,7 +104,7 @@ static av_cold av_unused int pcm_encode_init(AVCodecContext *avctx)
} \
}
-static av_unused int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+av_unused static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
int n, c, sample_size, ret;
@@ -263,7 +263,7 @@ typedef struct PCMDecode {
int sample_size;
} PCMDecode;
-static av_cold av_unused int pcm_decode_init(AVCodecContext *avctx)
+av_unused av_cold static int pcm_decode_init(AVCodecContext *avctx)
{
PCMDecode *s = avctx->priv_data;
static const struct {
@@ -313,7 +313,7 @@ typedef struct PCMScaleDecode {
float scale;
} PCMScaleDecode;
-static av_cold av_unused int pcm_scale_decode_init(AVCodecContext *avctx)
+av_unused av_cold static int pcm_scale_decode_init(AVCodecContext *avctx)
{
PCMScaleDecode *s = avctx->priv_data;
AVFloatDSPContext *fdsp;
@@ -339,7 +339,7 @@ typedef struct PCMLUTDecode {
int16_t table[256];
} PCMLUTDecode;
-static av_cold av_unused int pcm_lut_decode_init(AVCodecContext *avctx)
+av_unused av_cold static int pcm_lut_decode_init(AVCodecContext *avctx)
{
PCMLUTDecode *s = avctx->priv_data;
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index c3eee622d4..7eb2f2fed4 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -298,7 +298,7 @@ static inline void put_sbits(PutBitContext *pb, int n, int32_t value)
/**
* Write exactly 32 bits into a bitstream.
*/
-static void av_unused put_bits32(PutBitContext *s, uint32_t value)
+av_unused static void put_bits32(PutBitContext *s, uint32_t value)
{
BitBuf bit_buf;
int bit_left;
diff --git a/libavcodec/v210dec_init.h b/libavcodec/v210dec_init.h
index c7a232fe8e..a0c97bf426 100644
--- a/libavcodec/v210dec_init.h
+++ b/libavcodec/v210dec_init.h
@@ -51,7 +51,7 @@ static void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t *u,
}
}
-static av_unused av_cold void ff_v210dec_init(V210DecContext *s)
+av_unused static av_cold void ff_v210dec_init(V210DecContext *s)
{
s->unpack_frame = v210_planar_unpack_c;
#if ARCH_X86
diff --git a/libavcodec/v210enc_init.h b/libavcodec/v210enc_init.h
index a0e5622f4f..01b6981b50 100644
--- a/libavcodec/v210enc_init.h
+++ b/libavcodec/v210enc_init.h
@@ -76,7 +76,7 @@ static void v210_planar_pack_10_c(const uint16_t *y, const uint16_t *u,
}
}
-static av_cold av_unused void ff_v210enc_init(V210EncContext *s)
+av_unused av_cold static void ff_v210enc_init(V210EncContext *s)
{
s->pack_line_8 = v210_planar_pack_8_c;
s->pack_line_10 = v210_planar_pack_10_c;
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index e922a13c5e..af46e2f188 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -239,7 +239,7 @@ static int vp56_rac_gets(VPXRangeCoder *c, int bits)
}
// P(7)
-static av_unused int vp56_rac_gets_nn(VPXRangeCoder *c, int bits)
+av_unused static int vp56_rac_gets_nn(VPXRangeCoder *c, int bits)
{
int v = vp56_rac_gets(c, 7) << 1;
return v + !v;
diff --git a/libavcodec/vp89_rac.h b/libavcodec/vp89_rac.h
index bc0924c387..ff6cba5ba6 100644
--- a/libavcodec/vp89_rac.h
+++ b/libavcodec/vp89_rac.h
@@ -38,7 +38,7 @@ static av_always_inline int vp89_rac_get(VPXRangeCoder *c)
return vpx_rac_get_prob(c, 128);
}
-static av_unused int vp89_rac_get_uint(VPXRangeCoder *c, int bits)
+av_unused static int vp89_rac_get_uint(VPXRangeCoder *c, int bits)
{
int value = 0;
diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c
index 88bb67f78d..146cb0a7c7 100644
--- a/libavcodec/vp8dsp.c
+++ b/libavcodec/vp8dsp.c
@@ -249,14 +249,14 @@ MK_IDCT_DC_ADD4_C(vp8)
// because I like only having two parameters to pass functions...
#define LOAD_PIXELS \
- int av_unused p3 = p[-4 * stride]; \
- int av_unused p2 = p[-3 * stride]; \
- int av_unused p1 = p[-2 * stride]; \
- int av_unused p0 = p[-1 * stride]; \
- int av_unused q0 = p[ 0 * stride]; \
- int av_unused q1 = p[ 1 * stride]; \
- int av_unused q2 = p[ 2 * stride]; \
- int av_unused q3 = p[ 3 * stride];
+ av_unused int p3 = p[-4 * stride]; \
+ av_unused int p2 = p[-3 * stride]; \
+ av_unused int p1 = p[-2 * stride]; \
+ av_unused int p0 = p[-1 * stride]; \
+ av_unused int q0 = p[ 0 * stride]; \
+ av_unused int q1 = p[ 1 * stride]; \
+ av_unused int q2 = p[ 2 * stride]; \
+ av_unused int q3 = p[ 3 * stride];
#define clip_int8(n) (cm[(n) + 0x80] - 0x80)
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 243388a65b..a3385f9b25 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1057,7 +1057,7 @@ static int decode_frame(WmallDecodeCtx *s)
/* no idea what these are for, might be the number of samples
that need to be skipped at the beginning or end of a stream */
if (get_bits1(gb)) {
- int av_unused skip;
+ av_unused int skip;
/* usually true for the first frame */
if (get_bits1(gb)) {
diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index d69ccda89c..a345f64900 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -220,7 +220,7 @@ static void avg_h264_qpel16_mc00_sse2 (uint8_t *dst, const uint8_t *src,
#define avg_h264_qpel8_mc00_sse2 avg_h264_qpel8_mc00_mmxext
#define H264_MC_C(OPNAME, SIZE, MMX, ALIGN) \
-static void av_unused OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
+av_unused static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
{\
ff_ ## OPNAME ## pixels ## SIZE ## _ ## MMX(dst, src, stride, SIZE);\
}\
diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h
index 827e067a9b..ac68447323 100644
--- a/libavfilter/af_afirdsp.h
+++ b/libavfilter/af_afirdsp.h
@@ -70,7 +70,7 @@ static void dcmul_add_c(double *sum, const double *t, const double *c, ptrdiff_t
sum[2 * n] += t[2 * n] * c[2 * n];
}
-static av_unused void ff_afir_init(AudioFIRDSPContext *dsp)
+av_unused static void ff_afir_init(AudioFIRDSPContext *dsp)
{
dsp->fcmul_add = fcmul_add_c;
dsp->dcmul_add = dcmul_add_c;
diff --git a/libavfilter/vf_blend_init.h b/libavfilter/vf_blend_init.h
index 956e1cb9fc..98d440fe67 100644
--- a/libavfilter/vf_blend_init.h
+++ b/libavfilter/vf_blend_init.h
@@ -159,7 +159,7 @@ DEFINE_INIT_BLEND_FUNC(14, 16)
DEFINE_INIT_BLEND_FUNC(16, 16)
DEFINE_INIT_BLEND_FUNC(32, 32)
-static av_unused void ff_blend_init(FilterParams *param, int depth)
+av_unused static void ff_blend_init(FilterParams *param, int depth)
{
switch (depth) {
case 8:
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index d8dfd32858..1d4b2d3b6e 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -588,7 +588,7 @@ static int parse_psfile(AVFilterContext *ctx, const char *fname)
CurvesContext *curves = ctx->priv;
uint8_t *buf;
size_t size;
- int i, ret, av_unused(version), nb_curves;
+ int i, ret, version av_unused, nb_curves;
AVBPrint ptstr;
static const int comp_ids[] = {3, 0, 1, 2};
diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
index 647259a141..81487ba14b 100644
--- a/libavfilter/vf_dnn_detect.c
+++ b/libavfilter/vf_dnn_detect.c
@@ -389,7 +389,7 @@ static int dnn_detect_post_proc_ssd(AVFrame *frame, DNNData *output, int nb_outp
av_strlcpy(header->source, ctx->dnnctx.model_filename, sizeof(header->source));
for (int i = 0; i < proposal_count; ++i) {
- int av_unused image_id = (int)detections[i * detect_size + 0];
+ av_unused int image_id = (int)detections[i * detect_size + 0];
int label_id;
float conf, x0, y0, x1, y1;
diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h
index cbca3bc27c..156f6c61fe 100644
--- a/libavfilter/vf_eq.h
+++ b/libavfilter/vf_eq.h
@@ -118,7 +118,7 @@ static void process_c(EQParameters *param, uint8_t *dst, int dst_stride,
void ff_eq_init_x86(EQContext *eq);
-static av_unused void ff_eq_init(EQContext *eq)
+av_unused static void ff_eq_init(EQContext *eq)
{
eq->process = process_c;
#if ARCH_X86
diff --git a/libavfilter/vf_gblur_init.h b/libavfilter/vf_gblur_init.h
index 212db9f7a0..67ca46f95e 100644
--- a/libavfilter/vf_gblur_init.h
+++ b/libavfilter/vf_gblur_init.h
@@ -109,7 +109,7 @@ static void verti_slice_c(float *buffer, int width, int height,
steps, nu, boundaryscale, 1);
}
-static av_unused void ff_gblur_init(GBlurContext *s)
+av_unused static void ff_gblur_init(GBlurContext *s)
{
s->localbuf = NULL;
s->horiz_slice = horiz_slice_c;
diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h
index 5c1d69b2b6..0f5b0607c2 100644
--- a/libavfilter/vf_hflip_init.h
+++ b/libavfilter/vf_hflip_init.h
@@ -87,7 +87,7 @@ static void hflip_qword_c(const uint8_t *ssrc, uint8_t *ddst, int w)
dst[j] = src[-j];
}
-static av_unused int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
+av_unused static int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
{
for (int i = 0; i < nb_planes; i++) {
step[i] *= s->bayer_plus1;
diff --git a/libavfilter/vf_nlmeans_init.h b/libavfilter/vf_nlmeans_init.h
index 06e932936b..3a533a078a 100644
--- a/libavfilter/vf_nlmeans_init.h
+++ b/libavfilter/vf_nlmeans_init.h
@@ -124,7 +124,7 @@ static void compute_weights_line_c(const uint32_t *const iia,
}
}
-static av_unused void ff_nlmeans_init(NLMeansDSPContext *dsp)
+av_unused static void ff_nlmeans_init(NLMeansDSPContext *dsp)
{
dsp->compute_safe_ssd_integral_image = compute_safe_ssd_integral_image_c;
dsp->compute_weights_line = compute_weights_line_c;
diff --git a/libavfilter/vf_threshold_init.h b/libavfilter/vf_threshold_init.h
index 64a0a861ba..3add7b495e 100644
--- a/libavfilter/vf_threshold_init.h
+++ b/libavfilter/vf_threshold_init.h
@@ -74,7 +74,7 @@ static void threshold16(const uint8_t *iin, const uint8_t *tthreshold,
}
}
-static av_unused void ff_threshold_init(ThresholdContext *s)
+av_unused static void ff_threshold_init(ThresholdContext *s)
{
if (s->depth == 8) {
s->threshold = threshold8;
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 23ecb5bdb2..cbe39699a2 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -696,7 +696,7 @@ const FFFilter ff_vsrc_testsrc = {
#endif /* CONFIG_TESTSRC_FILTER */
-static void av_unused set_color(TestSourceContext *s, FFDrawColor *color, uint32_t argb)
+av_unused static void set_color(TestSourceContext *s, FFDrawColor *color, uint32_t argb)
{
uint8_t rgba[4] = { (argb >> 16) & 0xFF,
(argb >> 8) & 0xFF,
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index c9010179b8..3b46fe01f6 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -1527,7 +1527,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
int64_t itime, last_pos = -1;
int pct, ict;
int i;
- int64_t av_unused gsize = avio_rl64(s->pb);
+ av_unused int64_t gsize = avio_rl64(s->pb);
if ((ret = ff_get_guid(s->pb, &g)) < 0)
goto end;
itime = avio_rl64(s->pb);
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index dd187e600d..cc9c5ec396 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1246,7 +1246,7 @@ static int asf_read_packet_header(AVFormatContext *s)
ASFContext *asf = s->priv_data;
AVIOContext *pb = s->pb;
uint64_t size;
- uint32_t av_unused seq;
+ av_unused uint32_t seq;
unsigned char error_flags, len_flags, pay_flags;
asf->packet_offset = avio_tell(pb);
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 347b66d6d7..c2ba937b15 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -276,7 +276,7 @@ static int flac_probe(const AVProbeData *p)
return 0;
}
-static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index,
+av_unused static int64_t flac_read_timestamp(AVFormatContext *s, int stream_index,
int64_t *ppos, int64_t pos_limit)
{
FLACDecContext *flac = s->priv_data;
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index de5e688822..296d600cec 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -842,7 +842,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos)
FLVContext *flv = s->priv_data;
AMFDataType type;
AVStream *stream, *astream, *vstream;
- AVStream av_unused *dstream;
+ av_unused AVStream *dstream;
AVIOContext *ioc;
int i;
char buffer[32];
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index a5e51aa310..8c35a2122c 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -51,7 +51,7 @@ static int framecrc_write_header(struct AVFormatContext *s)
return ff_framehash_write_header(s);
}
-static av_unused void inline bswap(char *buf, int offset, int size)
+av_unused static void inline bswap(char *buf, int offset, int size)
{
if (size == 8) {
uint64_t val = AV_RN64(buf + offset);
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 849f22c60d..21a5d2fbf6 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -898,7 +898,7 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
int tunsync = 0;
int tcomp = 0;
int tencr = 0;
- unsigned long av_unused dlen;
+ av_unused unsigned long dlen;
if (isv34) {
if (avio_read(pb, tag, 4) < 4)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 1e0c75c51b..6c12e1594c 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1679,7 +1679,7 @@ static int matroska_decode_buffer(uint8_t **buf, int *buf_size,
uint8_t *data = *buf;
int isize = *buf_size;
uint8_t *pkt_data = NULL;
- uint8_t av_unused *newpktdata;
+ av_unused uint8_t *newpktdata;
int pkt_size = isize;
int result = 0;
int olen;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 8142d9125e..18f17f4329 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1201,7 +1201,7 @@ static int mkv_assemble_codecprivate(AVFormatContext *s, AVIOContext *dyn_cp,
uint8_t **codecpriv, int *codecpriv_size,
unsigned *max_payload_size)
{
- MatroskaMuxContext av_unused *const mkv = s->priv_data;
+ av_unused MatroskaMuxContext *const mkv = s->priv_data;
unsigned size_to_reserve = 0;
int ret;
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 5695eeec9e..0ebd480d3f 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -322,7 +322,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
if (pkt->data && pkt->size >= 4) {
MPADecodeHeader mpah;
int ret;
- int av_unused base;
+ av_unused int base;
uint32_t h;
h = AV_RB32(pkt->data);
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 981dd8cf0d..33f2914104 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -3331,7 +3331,7 @@ static int mpegts_read_close(AVFormatContext *s)
return 0;
}
-static av_unused int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
+av_unused static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
int64_t *ppos, int64_t pos_limit)
{
MpegTSContext *ts = s->priv_data;
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 9ec913ebbe..9b945a7c12 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -262,7 +262,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
{
NSVContext *nsv = s->priv_data;
AVIOContext *pb = s->pb;
- unsigned int av_unused file_size;
+ av_unused unsigned int file_size;
unsigned int size;
int64_t duration;
int strings_size;
@@ -578,7 +578,7 @@ null_chunk_retry:
av_log(s, AV_LOG_TRACE, "NSV CHUNK %d aux, %"PRIu32" bytes video, %d bytes audio\n", auxcount, vsize, asize);
/* skip aux stuff */
for (i = 0; i < auxcount; i++) {
- uint32_t av_unused auxtag;
+ av_unused uint32_t auxtag;
auxsize = avio_rl16(pb);
auxtag = avio_rl32(pb);
avio_skip(pb, auxsize);
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index c83399b8fc..7abbea3c41 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -58,7 +58,7 @@ static int r3d_read_red1(AVFormatContext *s)
char filename[258];
int tmp;
int ret;
- int av_unused tmp2;
+ av_unused int tmp2;
AVRational framerate;
if (!st)
@@ -143,7 +143,7 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
static void r3d_read_reos(AVFormatContext *s)
{
R3DContext *r3d = s->priv_data;
- int av_unused tmp;
+ av_unused int tmp;
r3d->rdvo_offset = avio_rb32(s->pb);
avio_rb32(s->pb); // rdvs offset
@@ -220,7 +220,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
{
AVStream *st = s->streams[0];
int tmp;
- int av_unused tmp2;
+ av_unused int tmp2;
int64_t pos = avio_tell(s->pb);
unsigned dts;
int ret;
@@ -275,7 +275,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
{
R3DContext *r3d = s->priv_data;
AVStream *st;
- int av_unused tmp, tmp2;
+ av_unused int tmp, tmp2;
int samples, size;
int64_t pos = avio_tell(s->pb);
unsigned dts;
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 405a900ce0..5872c0f59c 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -404,7 +404,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd,
return 0;
len = avio_close_dyn_buf(pb, &buf);
if ((len > 0) && buf) {
- int av_unused result;
+ av_unused int result;
av_log(s->ic, AV_LOG_TRACE, "sending %d bytes of RR\n", len);
result = ffurl_write(fd, buf, len);
av_log(s->ic, AV_LOG_TRACE, "result from ffurl_write: %d\n", result);
diff --git a/libavformat/rtspcodes.h b/libavformat/rtspcodes.h
index 0ae490a42e..64370296dd 100644
--- a/libavformat/rtspcodes.h
+++ b/libavformat/rtspcodes.h
@@ -75,7 +75,7 @@ RTSP_STATUS_VERSION =505,
RTSP_STATUS_UNSUPPORTED_OPTION =551,
};
-static const av_unused char * const rtsp_status_strings[] = {
+av_unused static const char * const rtsp_status_strings[] = {
[RTSP_STATUS_CONTINUE] ="Continue",
[RTSP_STATUS_OK] ="OK",
[RTSP_STATUS_CREATED] ="Created",
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 7fa5d5d9d5..8069ed88a2 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -552,7 +552,7 @@ static int parse_dB(AVExpr **e, Parser *p, int *sign)
for example, -3dB is not the same as -(3dB) */
if (*p->s == '-') {
char *next;
- double av_unused ignored = strtod(p->s, &next);
+ av_unused double ignored = strtod(p->s, &next);
if (next != p->s && next[0] == 'd' && next[1] == 'B') {
*sign = 0;
return parse_primary(e, p);
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 031884af8e..46424eb52a 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -288,7 +288,7 @@ static int opencl_check_device_extension(cl_device_id device_id,
return found;
}
-static av_unused int opencl_check_extension(AVHWDeviceContext *hwdev,
+av_unused static int opencl_check_extension(AVHWDeviceContext *hwdev,
const char *name)
{
OpenCLDeviceContext *priv = hwdev->hwctx;
diff --git a/libavutil/ripemd.c b/libavutil/ripemd.c
index e170c69f42..e3104efc9f 100644
--- a/libavutil/ripemd.c
+++ b/libavutil/ripemd.c
@@ -136,7 +136,7 @@ static const int WB[80] = {
static void ripemd128_transform(uint32_t *state, const uint8_t buffer[64])
{
- uint32_t a, b, c, d, e, f, g, h, av_unused t;
+ uint32_t a, b, c, d, e, f, g, h, t av_unused;
uint32_t block[16];
int n;
@@ -193,7 +193,7 @@ static void ripemd128_transform(uint32_t *state, const uint8_t buffer[64])
static void ripemd256_transform(uint32_t *state, const uint8_t buffer[64])
{
- uint32_t a, b, c, d, e, f, g, h, av_unused t;
+ uint32_t a, b, c, d, e, f, g, h, t av_unused;
uint32_t block[16];
int n;
@@ -318,7 +318,7 @@ static void ripemd256_transform(uint32_t *state, const uint8_t buffer[64])
static void ripemd160_transform(uint32_t *state, const uint8_t buffer[64])
{
- uint32_t a, b, c, d, e, f, g, h, i, j, av_unused t;
+ uint32_t a, b, c, d, e, f, g, h, i, j, t av_unused;
uint32_t block[16];
int n;
@@ -390,7 +390,7 @@ static void ripemd160_transform(uint32_t *state, const uint8_t buffer[64])
static void ripemd320_transform(uint32_t *state, const uint8_t buffer[64])
{
- uint32_t a, b, c, d, e, f, g, h, i, j, av_unused t;
+ uint32_t a, b, c, d, e, f, g, h, i, j, t av_unused;
uint32_t block[16];
int n;
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 399ca6d682..e2749975ac 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -241,7 +241,7 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
* @param s pointer to where sine in units of (1<<30) is returned
* @param c pointer to where cosine in units of (1<<30) is returned
*/
-static av_unused void av_sincos_sf(int a, int *s, int *c)
+av_unused static void av_sincos_sf(int a, int *s, int *c)
{
int idx, sign;
int sv, cv;
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 804f978593..40485a019c 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -720,7 +720,7 @@ int attribute_align_arg swr_convert(struct SwrContext *s,
{
AudioData * in= &s->in;
AudioData *out= &s->out;
- int av_unused max_output;
+ av_unused int max_output;
if (!swr_is_initialized(s)) {
av_log(s, AV_LOG_ERROR, "Context has not been initialized\n");
diff --git a/libswresample/x86/resample_init.c b/libswresample/x86/resample_init.c
index d13ccd4833..5e12f2bddf 100644
--- a/libswresample/x86/resample_init.c
+++ b/libswresample/x86/resample_init.c
@@ -47,7 +47,7 @@ RESAMPLE_FUNCS(double, fma3);
av_cold void swri_resample_dsp_x86_init(ResampleContext *c)
{
- int av_unused mm_flags = av_get_cpu_flags();
+ av_unused int mm_flags = av_get_cpu_flags();
switch(c->format){
case AV_SAMPLE_FMT_S16P:
diff --git a/libswscale/loongarch/yuv2rgb_lasx.c b/libswscale/loongarch/yuv2rgb_lasx.c
index e9e4a63a0a..d83e5d70fe 100644
--- a/libswscale/loongarch/yuv2rgb_lasx.c
+++ b/libswscale/loongarch/yuv2rgb_lasx.c
@@ -206,7 +206,7 @@
vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
for (y = 0; y < srcSliceH; y += 2) { \
int yd = y + srcSliceY; \
- dst_type av_unused *r, *g, *b; \
+ av_unused dst_type *r, *g, *b; \
dst_type *image1 = (dst_type *)(dst[0] + (yd) * dstStride[0]); \
dst_type *image2 = (dst_type *)(dst[0] + (yd + 1) * dstStride[0]); \
const uint8_t *py_1 = src[0] + y * srcStride[0]; \
diff --git a/libswscale/loongarch/yuv2rgb_lsx.c b/libswscale/loongarch/yuv2rgb_lsx.c
index 6339d07d6c..919fd00234 100644
--- a/libswscale/loongarch/yuv2rgb_lsx.c
+++ b/libswscale/loongarch/yuv2rgb_lsx.c
@@ -132,7 +132,7 @@
res = (c->opts.dst_w & 15) >> 1; \
vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
for (y = 0; y < srcSliceH; y += 2) { \
- dst_type av_unused *r, *g, *b; \
+ av_unused dst_type *r, *g, *b; \
dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\
dst_type *image2 = (dst_type *)(image1 + dstStride[0]);\
const uint8_t *py_1 = src[0] + y * srcStride[0]; \
@@ -161,7 +161,7 @@
vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
for (y = 0; y < srcSliceH; y += 2) { \
int yd = y + srcSliceY; \
- dst_type av_unused *r, *g, *b; \
+ av_unused dst_type *r, *g, *b; \
dst_type *image1 = (dst_type *)(dst[0] + (yd) * dstStride[0]); \
dst_type *image2 = (dst_type *)(dst[0] + (yd + 1) * dstStride[0]); \
const uint8_t *py_1 = src[0] + y * srcStride[0]; \
@@ -179,7 +179,7 @@
image2 += 48; \
} \
for (x = 0; x < res; x++) { \
- int av_unused U, V, Y; \
+ av_unused int U, V, Y; \
U = pu[0]; \
V = pv[0]; \
r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
@@ -196,7 +196,7 @@
image2 += 16; \
} \
for (x = 0; x < res; x++) { \
- int av_unused U, V, Y; \
+ av_unused int U, V, Y; \
U = pu[0]; \
V = pv[0]; \
r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
diff --git a/libswscale/ppc/swscale_ppc_template.c b/libswscale/ppc/swscale_ppc_template.c
index 46fd2bee62..7e502d5069 100644
--- a/libswscale/ppc/swscale_ppc_template.c
+++ b/libswscale/ppc/swscale_ppc_template.c
@@ -47,7 +47,7 @@ static void FUNC(yuv2planeX_8_16)(const int16_t *filter, int filterSize,
for (j = 0; j < filterSize; j++) {
unsigned int joffset=j<<1;
unsigned int xoffset=x<<1;
- vector unsigned char av_unused perm;
+ av_unused vector unsigned char perm;
vector signed short l1,vLumFilter;
LOAD_FILTER(vLumFilter,filter);
vLumFilter = vec_splat(vLumFilter, 0);
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 8b6f9bd58a..85faf92c56 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -72,7 +72,7 @@ void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
int16_t *vChrFilter= c->vChrFilter;
int32_t *lumMmxFilter= c->lumMmxFilter;
int32_t *chrMmxFilter= c->chrMmxFilter;
- int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
+ av_unused int32_t *alpMmxFilter= c->alpMmxFilter;
const int vLumFilterSize= c->vLumFilterSize;
const int vChrFilterSize= c->vChrFilterSize;
const int chrDstY= dstY>>c->chrDstVSubSample;
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index ff8e013da4..48089760f5 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -147,14 +147,14 @@ const int *sws_getCoefficients(int colorspace)
(dst_type *)(dst[0] + (yd) * dstStride[0]); \
dst_type *dst_2 = \
(dst_type *)(dst[0] + (yd + 1) * dstStride[0]); \
- dst_type av_unused *dst1_1, *dst1_2, *dst2_1, *dst2_2; \
- dst_type av_unused *r, *g, *b; \
+ av_unused dst_type *dst1_1, *dst1_2, *dst2_1, *dst2_2; \
+ av_unused dst_type *r, *g, *b; \
const uint8_t *py_1 = src[0] + y * srcStride[0]; \
const uint8_t *py_2 = py_1 + srcStride[0]; \
- const uint8_t av_unused *pu_1 = src[1] + (y >> !yuv422) * srcStride[1]; \
- const uint8_t av_unused *pv_1 = src[2] + (y >> !yuv422) * srcStride[2]; \
- const uint8_t av_unused *pu_2, *pv_2; \
- const uint8_t av_unused *pa_1, *pa_2; \
+ av_unused const uint8_t *pu_1 = src[1] + (y >> !yuv422) * srcStride[1]; \
+ av_unused const uint8_t *pv_1 = src[2] + (y >> !yuv422) * srcStride[2]; \
+ av_unused const uint8_t *pu_2, *pv_2; \
+ av_unused const uint8_t *pa_1, *pa_2; \
unsigned int h_size = c->opts.dst_w >> 3; \
if (nb_dst_planes > 1) { \
dst1_1 = (dst_type *)(dst[1] + (yd) * dstStride[1]); \
@@ -171,7 +171,7 @@ const int *sws_getCoefficients(int colorspace)
pa_2 = pa_1 + srcStride[3]; \
} \
while (h_size--) { \
- int av_unused U, V, Y; \
+ av_unused int U, V, Y; \
#define ENDYUV2RGBLINE(dst_delta, ss, alpha, yuv422, nb_dst_planes) \
pu_1 += 4 >> ss; \
@@ -196,7 +196,7 @@ const int *sws_getCoefficients(int colorspace)
} \
} \
if (c->opts.dst_w & (4 >> ss)) { \
- int av_unused Y, U, V; \
+ av_unused int Y, U, V; \
#define ENDYUV2RGBFUNC() \
} \
@@ -486,7 +486,7 @@ YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0, 0, 1)
dst_2 += 1;
}
if (c->opts.dst_w & 7) {
- int av_unused Y, U, V;
+ av_unused int Y, U, V;
int pixels_left = c->opts.dst_w & 7;
const uint8_t *d128 = ff_dither_8x8_220[yd & 7];
char out_1 = 0, out_2 = 0;
diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h
index 1684c427d6..4f7307641f 100644
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -184,7 +184,7 @@ int double_near_abs_eps_array(const double *a, const double *b, double eps,
extern AVLFG checkasm_lfg;
#define rnd() av_lfg_get(&checkasm_lfg)
-static av_unused void *func_ref, *func_new;
+av_unused static void *func_ref, *func_new;
extern uint64_t bench_runs;
--
2.49.1
From 7419dfffaf5784fa358b63574858cd833989c527 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Thu, 25 Sep 2025 19:10:01 +0200
Subject: [PATCH 2/4] avutil/attributes: add AV_HAS_STD_ATTRIBUTE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
For testing language standard attributes, for both C++ and C.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavutil/attributes.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index d15ede1286..2c08ea31bd 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -40,6 +40,14 @@
# define AV_HAS_BUILTIN(x) 0
#endif
+#if defined(__cplusplus) && defined(__has_cpp_attribute)
+# define AV_HAS_STD_ATTRIBUTE(x) __has_cpp_attribute(x)
+#elif !defined(__cplusplus) && defined(__has_c_attribute)
+# define AV_HAS_STD_ATTRIBUTE(x) __has_c_attribute(x)
+#else
+# define AV_HAS_STD_ATTRIBUTE(x) 0
+#endif
+
#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_always_inline __attribute__((always_inline)) inline
--
2.49.1
From e5071bf4c1746a08f916a6445d6ba7b51a5cbd01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Thu, 25 Sep 2025 19:22:39 +0200
Subject: [PATCH 3/4] avutil/attributes: use standard attributes when they are
available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavutil/attributes.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 2c08ea31bd..993ec6e1da 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -66,7 +66,9 @@
#endif
#endif
-#if AV_GCC_VERSION_AT_LEAST(3,4)
+#if AV_HAS_STD_ATTRIBUTE(nodiscard)
+# define av_warn_unused_result [[nodiscard]]
+#elif AV_GCC_VERSION_AT_LEAST(3,4)
# define av_warn_unused_result __attribute__((warn_unused_result))
#else
# define av_warn_unused_result
@@ -104,7 +106,9 @@
# define av_flatten
#endif
-#if AV_GCC_VERSION_AT_LEAST(3,1)
+#if AV_HAS_STD_ATTRIBUTE(deprecated)
+# define attribute_deprecated [[deprecated]]
+#elif AV_GCC_VERSION_AT_LEAST(3,1)
# define attribute_deprecated __attribute__((deprecated))
#elif defined(_MSC_VER)
# define attribute_deprecated __declspec(deprecated)
@@ -135,7 +139,9 @@
#endif
#endif
-#if defined(__GNUC__) || defined(__clang__)
+#if AV_HAS_STD_ATTRIBUTE(maybe_unused)
+# define av_unused [[maybe_unused]]
+#elif defined(__GNUC__) || defined(__clang__)
# define av_unused __attribute__((unused))
#else
# define av_unused
@@ -174,7 +180,9 @@
# define av_scanf_format(fmtpos, attrpos)
#endif
-#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
+#if AV_HAS_STD_ATTRIBUTE(noreturn)
+# define av_noreturn [[noreturn]]
+#elif AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
# define av_noreturn __attribute__((noreturn))
#else
# define av_noreturn
--
2.49.1
From d81ee77f6c9237ff2129ad36f6f05b23f0efd776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Thu, 25 Sep 2025 19:24:19 +0200
Subject: [PATCH 4/4] avutil/attributes: prefer clang attributes even in
non-gnu builds
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In MSVC mode Clang doesn't define __GNUC__, but we can still attributes.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
---
libavutil/attributes.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 993ec6e1da..772e327fa4 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -49,7 +49,7 @@
#endif
#ifndef av_always_inline
-#if AV_GCC_VERSION_AT_LEAST(3,1)
+#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
# define av_always_inline __attribute__((always_inline)) inline
#elif defined(_MSC_VER)
# define av_always_inline __forceinline
@@ -68,13 +68,13 @@
#if AV_HAS_STD_ATTRIBUTE(nodiscard)
# define av_warn_unused_result [[nodiscard]]
-#elif AV_GCC_VERSION_AT_LEAST(3,4)
+#elif AV_GCC_VERSION_AT_LEAST(3,4) || defined(__clang__)
# define av_warn_unused_result __attribute__((warn_unused_result))
#else
# define av_warn_unused_result
#endif
-#if AV_GCC_VERSION_AT_LEAST(3,1)
+#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
# define av_noinline __attribute__((noinline))
#elif defined(_MSC_VER)
# define av_noinline __declspec(noinline)
@@ -108,7 +108,7 @@
#if AV_HAS_STD_ATTRIBUTE(deprecated)
# define attribute_deprecated [[deprecated]]
-#elif AV_GCC_VERSION_AT_LEAST(3,1)
+#elif AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
# define attribute_deprecated __attribute__((deprecated))
#elif defined(_MSC_VER)
# define attribute_deprecated __declspec(deprecated)
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-25 18:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-25 18:06 [FFmpeg-devel] [PATCH] avutil/attributes: use standard attributes when they are available (PR #20608) Kacper Michajłow via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ http://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git