damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

flatcc_assert.h (1179B)


      1 #ifndef FLATCC_ASSERT_H
      2 #define FLATCC_ASSERT_H
      3 
      4 #ifdef __cplusplus
      5 extern "C" {
      6 #endif
      7 
      8 /*
      9 * This assert abstraction is only used for the flatcc runtime library.
     10 * The flatcc compiler uses Posix assert routines regardless of how this
     11 * file is configured.
     12 *
     13 * This header makes it possible to use systems where assert is not
     14 * valid to use. Note that `<assert.h>` may remain a dependency for static
     15 * assertions.
     16 *
     17 * `FLATCC_ASSERT` is designed to handle errors which cannot be ignored
     18 * and could lead to crash. The portable library may use assertions that
     19 * are not affected by this macro.
     20 *
     21 * `FLATCC_ASSERT` defaults to POSIX assert but can be overrided by a
     22 * preprocessor definition.
     23 *
     24 * Runtime assertions can be entirely disabled by defining
     25 * `FLATCC_NO_ASSERT`.
     26 */
     27 
     28 #ifdef FLATCC_NO_ASSERT 
     29 /* NOTE: This will not affect inclusion of <assert.h> for static assertions. */
     30 #undef FLATCC_ASSERT
     31 #define FLATCC_ASSERT(x) ((void)0)
     32 /* Grisu3 is used for floating point conversion in JSON processing. */
     33 #define GRISU3_NO_ASSERT
     34 #endif
     35 
     36 #ifndef FLATCC_ASSERT
     37 #include <assert.h>
     38 #define FLATCC_ASSERT assert
     39 #endif
     40 
     41 #ifdef __cplusplus
     42 }
     43 #endif
     44 
     45 #endif /* FLATCC_ASSERT_H */