Loading...
Searching...
No Matches
avassert.h File Reference

simple assert() macros that are a bit more flexible than ISO C assert(). More...

`#include <stdlib.h>`
`#include "attributes.h"`
`#include "log.h"`
`#include "macros.h"`

Go to the source code of this file.

## Macros

#define | av_assert0(cond)
| assert() equivalent, that is always enabled.
#define | av_assert1(cond)
| assert() equivalent, that does not lie in speed critical code.
#define | av_assert2(cond)
| assert() equivalent, that does lie in speed critical code.
#define | av_assert2_fpu()
#define | av_unreachable(msg)
| Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
#define | av_assume(cond)

## Functions

void | av_assert0_fpu (void)
| Assert that floating point operations can be executed.

## Detailed Description

simple assert() macros that are a bit more flexible than ISO C assert().

Author
  Michael Niedermayer micha.nosp@m.elni.nosp@m.@gmx..nosp@m.at

Definition in file avassert.h.

## Macro Definition Documentation

## av_assert0

#define av_assert0 | ( |  | cond | ) |

Value:
do { \
if (!(cond)) { \
av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \
AV_STRINGIFY(cond), __FILE__, __LINE__); \
abort(); \
} \
} while (0)
AV_LOG_PANIC
#define AV_LOG_PANIC
Something went really wrong and we will crash now.
Definition log.h:197
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition macros.h:66

assert() equivalent, that is always enabled.

Examples
  mux.c, and transcode_aac.c.

Definition at line 41 of file avassert.h.

Referenced by av_get_detection_bbox(), av_iamf_param_definition_get_subblock(), av_tdrdi_get_display(), av_video_enc_params_block(), init_resampler(), and write_audio_frame().

## av_assert1

#define av_assert1 | ( |  | cond | ) |

Value:
((void)0)

assert() equivalent, that does not lie in speed critical code.

These asserts() thus can be enabled without fearing speed loss.

Definition at line 57 of file avassert.h.

## av_assert2

#define av_assert2 | ( |  | cond | ) |

Value:
((void)0)

assert() equivalent, that does lie in speed critical code.

Definition at line 68 of file avassert.h.

## av_assert2_fpu

#define av_assert2_fpu | ( |  | ) |

Value:
((void)0)

Definition at line 69 of file avassert.h.

## av_unreachable

#define av_unreachable | ( |  | msg | ) |

Value:
do { \
av_log(NULL, AV_LOG_PANIC, \
"Reached supposedly unreachable code at %s:%d: %s\n", \
__FILE__, __LINE__, msg); \
abort(); \
} while (0)

Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.

Undefined behaviour occurs if execution reaches a point marked with av_unreachable() or if a condition used with av_assume() is false.

The condition used with av_assume() should not have side-effects and should be visible to the compiler.

Definition at line 91 of file avassert.h.

## av_assume

#define av_assume | ( |  | cond | ) |

Value:
av_assert0(cond)
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:41

Definition at line 98 of file avassert.h.

## Function Documentation

## av_assert0_fpu()

void av_assert0_fpu | ( | void |  | ) |

Assert that floating point operations can be executed.

This will av_assert0() that the cpu is not in MMX state on X86