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


Ignore:
Timestamp:
2011-05-21T15:45:48Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d47440, e06e2716
Parents:
faeb7cc
Message:

Merge the functionality of assert_abort() and assert_static_abort() into
assert_abort().

Print the unexpanded message to klog first. Then try to print the
message and the stack trace to standard output using printf. Use the
same unabbreviated message wording for both klog and stdout. If a
nested or a parallel assert is detected, send the message only to klog
and then abort.

Re-introduce malloc_assert() to up the malloc_futex. This appears to be
inevitable if we want to print to stdout. To prevent undesired macro
expansion, call assert_abort() from malloc_assert() directly.

File:
1 edited

Legend:

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

    rfaeb7cc r13f2461  
    4747 */
    4848
     49#define STR(l)  #l
     50#define STR2(l) STR(l)
     51
    4952#ifndef NDEBUG
    5053
     
    5255        do { \
    5356                if (!(expr)) \
    54                         assert_abort(#expr, __FILE__, __LINE__); \
    55         } while (0)
    56 
    57 #define assert_static(expr) \
    58         do { \
    59                 if (!(expr)) \
    60                         assert_static_abort("Assertion failed (" #expr \
    61                             ") in file \"" __FILE__ "\".\n"); \
     57                        assert_abort(#expr, __FILE__, STR2(__LINE__)); \
    6258        } while (0)
    6359
     
    6561
    6662#define assert(expr)
    67 #define assert_static(expr)
    6863
    6964#endif /* NDEBUG */
    7065
    71 extern void assert_abort(const char *, const char *, unsigned int)
     66extern void assert_abort(const char *, const char *, const char *)
    7267    __attribute__((noreturn));
    73 extern void assert_static_abort(const char *);
    7468
    7569
Note: See TracChangeset for help on using the changeset viewer.