1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-29 00:06:33 +00:00
oot/include/libc/assert.h
Tharo df5d4cb467
[Audio 10/10] Loose ends (#2337)
* Introduce afile_sizes, generate headers of sizes for soundfonts and sequences

* Initial tools/audio README

* Versioning for samplebank extraction

* Clean up the disassemble_sequence.py runnable interface

* Add static assertions for maximum bank sizes

* Boost optimization for audio tools

* Samplebank XML doc

* Soundfont XML doc

* More docs in sampleconv for vadpcm

* Various tools fixes/cleanup

* VADPCM doc

* Try to fix md formatting

* VADPCM doc can come later

* Fix merge with PR 9

* Fix blobs from MM

* Try to fix bss

* Try fix bss round 2

* Fix sampleconv memset bug

* Suggested documentation tweaks
2024-12-13 19:26:36 -05:00

45 lines
1.1 KiB
C

#ifndef ASSERT_H
#define ASSERT_H
#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(x)
#endif
// Runtime assertions
__attribute__((noreturn)) void __assert(const char* assertion, const char* file, int line);
// assert for matching
#ifndef NDEBUG
# ifndef NON_MATCHING
# define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : __assert(msg, file, line))
# else
# define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : __assert(#cond, __FILE__, __LINE__))
# endif
#else
# define ASSERT(cond, msg, file, line) ((void)0)
#endif
// standard assert macro
#ifndef NDEBUG
# define assert(cond) ASSERT(cond, #cond, __FILE__, __LINE__)
#else
# define assert(cond) ((void)0)
#endif
// Static/compile-time assertions
#if !defined(__sgi) && (defined(__GNUC__) || (__STDC_VERSION__ >= 201112L))
# define static_assert(cond, msg) _Static_assert(cond, msg)
#else
# ifndef GLUE
# define GLUE(a, b) a##b
# endif
# ifndef GLUE2
# define GLUE2(a, b) GLUE(a, b)
# endif
# define static_assert(cond, msg) typedef char GLUE2(static_assertion_failed, __LINE__)[(cond) ? 1 : -1]
#endif
#endif