mirror of https://git.ffmpeg.org/ffmpeg.git
lib*/version: Use static_assert for static asserts
Also update the checks that guard against inserting a new enum entry in the middle of a range. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
2d38141ea6
commit
b616be1649
|
@ -18,9 +18,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "avcodec.h"
|
||||
#include "codec_id.h"
|
||||
#include "version.h"
|
||||
|
@ -30,10 +31,15 @@ const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
|||
|
||||
unsigned avcodec_version(void)
|
||||
{
|
||||
av_assert0(AV_CODEC_ID_PCM_S8_PLANAR==65563);
|
||||
av_assert0(AV_CODEC_ID_ADPCM_G722==69660);
|
||||
av_assert0(AV_CODEC_ID_SRT==94216);
|
||||
av_assert0(LIBAVCODEC_VERSION_MICRO >= 100);
|
||||
static_assert(AV_CODEC_ID_LEAD == 269 &&
|
||||
AV_CODEC_ID_PCM_SGA == 65572 &&
|
||||
AV_CODEC_ID_ADPCM_XMD == 69683 &&
|
||||
AV_CODEC_ID_CBD2_DPCM == 81928 &&
|
||||
AV_CODEC_ID_QOA == 86121 &&
|
||||
AV_CODEC_ID_ARIB_CAPTION == 94233 &&
|
||||
AV_CODEC_ID_SMPTE_2038 == 98315,
|
||||
"Don't insert new codec ids in the middle of a list");
|
||||
static_assert(LIBAVCODEC_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
|
||||
return LIBAVCODEC_VERSION_INT;
|
||||
}
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "avdevice.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -29,7 +30,7 @@ const char av_device_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
|||
|
||||
unsigned avdevice_version(void)
|
||||
{
|
||||
av_assert0(LIBAVDEVICE_VERSION_MICRO >= 100);
|
||||
static_assert(LIBAVDEVICE_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
return LIBAVDEVICE_VERSION_INT;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "avfilter.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -28,7 +29,7 @@ const char av_filter_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
|||
|
||||
unsigned avfilter_version(void)
|
||||
{
|
||||
av_assert0(LIBAVFILTER_VERSION_MICRO >= 100);
|
||||
static_assert(LIBAVFILTER_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
return LIBAVFILTER_VERSION_INT;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "avformat.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -29,7 +30,7 @@ const char av_format_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
|||
|
||||
unsigned avformat_version(void)
|
||||
{
|
||||
av_assert0(LIBAVFORMAT_VERSION_MICRO >= 100);
|
||||
static_assert(LIBAVFORMAT_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
return LIBAVFORMAT_VERSION_INT;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "avassert.h"
|
||||
#include "avutil.h"
|
||||
#include "samplefmt.h"
|
||||
#include "version.h"
|
||||
|
@ -34,10 +35,11 @@ const char *av_version_info(void)
|
|||
|
||||
unsigned avutil_version(void)
|
||||
{
|
||||
av_assert0(AV_SAMPLE_FMT_DBLP == 9);
|
||||
av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4);
|
||||
av_assert0(AV_PICTURE_TYPE_BI == 7);
|
||||
av_assert0(LIBAVUTIL_VERSION_MICRO >= 100);
|
||||
static_assert(AV_SAMPLE_FMT_S64P == 11 &&
|
||||
AVMEDIA_TYPE_ATTACHMENT == 4 &&
|
||||
AV_PICTURE_TYPE_BI == 7,
|
||||
"Don't insert new sample/media/picture types in the middle of the list");
|
||||
static_assert(LIBAVUTIL_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
|
||||
return LIBAVUTIL_VERSION_INT;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "postprocess.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -28,7 +29,7 @@ const char postproc_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
|||
|
||||
unsigned postproc_version(void)
|
||||
{
|
||||
av_assert0(LIBPOSTPROC_VERSION_MICRO >= 100);
|
||||
static_assert(LIBPOSTPROC_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
return LIBPOSTPROC_VERSION_INT;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "swresample.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -28,7 +29,7 @@ const char swr_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
|
|||
|
||||
unsigned swresample_version(void)
|
||||
{
|
||||
av_assert0(LIBSWRESAMPLE_VERSION_MICRO >= 100);
|
||||
static_assert(LIBSWRESAMPLE_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
return LIBSWRESAMPLE_VERSION_INT;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,15 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "swscale.h"
|
||||
#include "version.h"
|
||||
|
||||
unsigned swscale_version(void)
|
||||
{
|
||||
av_assert0(LIBSWSCALE_VERSION_MICRO >= 100);
|
||||
static_assert(LIBSWSCALE_VERSION_MICRO >= 100, "micro version starts at 100");
|
||||
return LIBSWSCALE_VERSION_INT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue