Changeset 955f2a5 in mainline for uspace/lib/c/include/assert.h


Ignore:
Timestamp:
2011-05-21T11:26:23Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b3e854
Parents:
0c33b1d5
Message:

implement assert_static() as a safer replacement to malloc_assert()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/assert.h

    r0c33b1d5 r955f2a5  
    5555        } while (0)
    5656
     57#define assert_static(expr) \
     58        do { \
     59                if (!(expr)) \
     60                        assert_static_abort("Assertion failed (" #expr \
     61                            ") in file \"" __FILE__ "\".\n"); \
     62        } while (0)
     63
    5764#else /* NDEBUG */
    5865
    5966#define assert(expr)
     67#define assert_static(expr)
    6068
    6169#endif /* NDEBUG */
     
    6371extern void assert_abort(const char *, const char *, unsigned int)
    6472    __attribute__((noreturn));
     73extern void assert_static_abort(const char *);
     74
    6575
    6676#endif
Note: See TracChangeset for help on using the changeset viewer.