• Andreas Rheinhardt's avatar
    avcodec/cbs: Avoid leaving the ... out in calls to variadic macros · 14dd0a90
    Andreas Rheinhardt authored
    According to C99, there has to be at least one argument for every ...
    in a variadic function-like macro. In practice most (all?) compilers also
    allow to leave it completely out, but it is nevertheless required: In a
    variadic macro "there shall be more arguments in the invocation than there
    are parameters in the macro definition (excluding the ...)." (C99,
    6.10.3.4).
    
    CBS (not the framework itself, but the macros used in the
    cbs_*_syntax_template.c files) relies on the compiler allowing to leave
    a variadic macro argument out. This leads to warnings when compiling in
    -pedantic mode, e.g. "warning: must specify at least one argument for
    '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]"
    from Clang.
    
    Most of these warnings can be easily avoided: The syntax_templates
    mostly contain helper macros that expand to more complex variadic macros
    and these helper macros often omit an argument for the .... Modifying
    them to always expand to complex macros with an empty argument for the
    ... at the end fixes most of these warnings: The number of warnings went
    down from 400 to 0 for cbs_av1, from 1114 to 32 for cbs_h2645, from 38 to
    0 for cbs_jpeg, from 166 to 0 for cbs_mpeg2 and from 110 to 8 for cbs_vp9.
    
    These eight remaining warnings for cbs_vp9 have been fixed by switching
    to another macro in cbs_vp9_syntax_template: The fixed values for the
    sync bytes as well as the trailing bits for byte-alignment are now read
    via the fixed() macro (this also adds a check to ensure that trailing
    bits are indeed zero as they have to be).
    Reviewed-by: 's avatarMark Thompson <sw@jkqxz.net>
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    14dd0a90
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...