Path: blob/master/dep/ffmpeg/include/libavutil/avassert.h
4216 views
/*1* copyright (c) 2010 Michael Niedermayer <[email protected]>2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920/**21* @file22* simple assert() macros that are a bit more flexible than ISO C assert().23* @author Michael Niedermayer <[email protected]>24*/2526#ifndef AVUTIL_AVASSERT_H27#define AVUTIL_AVASSERT_H2829#include <stdlib.h>30#ifdef HAVE_AV_CONFIG_H31# include "config.h"32#endif33#include "log.h"34#include "macros.h"3536/**37* assert() equivalent, that is always enabled.38*/39#define av_assert0(cond) do { \40if (!(cond)) { \41av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \42AV_STRINGIFY(cond), __FILE__, __LINE__); \43abort(); \44} \45} while (0)464748/**49* assert() equivalent, that does not lie in speed critical code.50* These asserts() thus can be enabled without fearing speed loss.51*/52#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 053#define av_assert1(cond) av_assert0(cond)54#else55#define av_assert1(cond) ((void)0)56#endif575859/**60* assert() equivalent, that does lie in speed critical code.61*/62#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 163#define av_assert2(cond) av_assert0(cond)64#define av_assert2_fpu() av_assert0_fpu()65#else66#define av_assert2(cond) ((void)0)67#define av_assert2_fpu() ((void)0)68#endif6970/**71* Assert that floating point operations can be executed.72*73* This will av_assert0() that the cpu is not in MMX state on X8674*/75void av_assert0_fpu(void);7677#endif /* AVUTIL_AVASSERT_H */787980