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


Ignore:
Timestamp:
2011-06-01T08:43:42Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d6c1f1
Parents:
9e2e715 (diff), e51a514 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Huuuuuge merge from development - all the work actually :)

File:
1 edited

Legend:

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

    r9e2e715 reb522e8  
    4040 *
    4141 * If NDEBUG is not set, the assert() macro
    42  * evaluates expr and if it is false prints 
     42 * evaluates expr and if it is false prints
    4343 * error message and terminate program.
    4444 *
     
    4747 */
    4848
    49 #include <stdio.h>
    50 #include <stdlib.h>
     49#ifndef NDEBUG
    5150
    52 #ifndef NDEBUG
    53 #       define assert(expr) \
    54                 do { \
    55                         if (!(expr)) { \
    56                                 printf("Assertion failed (%s) at file '%s', " \
    57                                     "line %d.\n", #expr, __FILE__, __LINE__); \
    58                                 abort(); \
    59                         } \
    60                 } while (0)
    61 #else
    62 #       define assert(expr)
    63 #endif
     51#define assert(expr) \
     52        do { \
     53                if (!(expr)) \
     54                        assert_abort(#expr, __FILE__, __LINE__); \
     55        } while (0)
     56
     57#else /* NDEBUG */
     58
     59#define assert(expr)
     60
     61#endif /* NDEBUG */
     62
     63extern void assert_abort(const char *, const char *, unsigned int)
     64    __attribute__((noreturn));
    6465
    6566#endif
Note: See TracChangeset for help on using the changeset viewer.