Changeset e8d3c6f5 in mainline
- Timestamp:
- 2018-01-13T00:38:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36f0738
- Parents:
- 9ba415e
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-12 23:46:12)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-13 00:38:49)
- Location:
- uspace/lib
- Files:
-
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/assert.c
r9ba415e re8d3c6f5 41 41 static atomic_t failed_asserts = {0}; 42 42 43 void assert_abort(const char *cond, const char *file, unsigned int line) 43 void __helenos_assert_quick_abort(const char *cond, const char *file, unsigned int line) 44 { 45 /* 46 * Send the message safely to kio. Nested asserts should not occur. 47 */ 48 kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n", 49 cond, file, line); 50 51 /* Sometimes we know in advance that regular printf() would likely fail. */ 52 abort(); 53 } 54 55 void __helenos_assert_abort(const char *cond, const char *file, unsigned int line) 44 56 { 45 57 /* -
uspace/lib/c/generic/malloc.c
r9ba415e re8d3c6f5 33 33 /** @file 34 34 */ 35 36 #define _HELENOS_SOURCE 35 37 36 38 #include <malloc.h> … … 196 198 static futex_t malloc_futex = FUTEX_INITIALIZER; 197 199 198 #ifndef NDEBUG 199 200 #define malloc_assert(expr) \ 201 do { \ 202 if (!(expr)) {\ 203 heap_unlock(); \ 204 assert_abort(#expr, __FILE__, __LINE__); \ 205 } \ 206 } while (0) 207 208 #else /* NDEBUG */ 209 210 #define malloc_assert(expr) 211 212 #endif /* NDEBUG */ 213 200 #define malloc_assert(expr) safe_assert(expr) 214 201 215 202 #ifdef FUTEX_UPGRADABLE -
uspace/lib/c/include/assert.h
r9ba415e re8d3c6f5 34 34 */ 35 35 36 // XXX: The definition of `assert()` is not guarded. 37 // One must not use `#pragma once` in this header. 38 // This is in accordance with the C standard. 39 36 40 #ifndef LIBC_ASSERT_H_ 37 41 #define LIBC_ASSERT_H_ 38 42 39 43 #define static_assert(expr) _Static_assert(expr, "") 44 45 extern void __helenos_assert_abort(const char *, const char *, unsigned int) 46 __attribute__((noreturn)); 47 48 extern void __helenos_assert_quick_abort(const char *, const char *, unsigned int) 49 __attribute__((noreturn)); 50 51 #endif 40 52 41 53 /** Debugging assert macro … … 49 61 */ 50 62 63 #undef assert 64 51 65 #ifndef NDEBUG 66 #define assert(expr) ((expr) ? (void) 0 : __helenos_assert_abort(#expr, __FILE__, __LINE__)) 67 #else 68 #define assert(expr) ((void) 0) 69 #endif 52 70 53 #define assert(expr) \ 54 do { \ 55 if (!(expr)) \ 56 assert_abort(#expr, __FILE__, __LINE__); \ 57 } while (0) 71 #ifdef _HELENOS_SOURCE 58 72 59 # else /* NDEBUG */73 #undef safe_assert 60 74 61 #define assert(expr) 75 #ifndef NDEBUG 76 #define safe_assert(expr) ((expr) ? (void) 0 : __helenos_assert_quick_abort(#expr, __FILE__, __LINE__)) 77 #else 78 #define safe_assert(expr) ((void) 0) 79 #endif 62 80 63 #endif /* NDEBUG */ 64 65 extern void assert_abort(const char *, const char *, unsigned int) 66 __attribute__((noreturn)); 67 68 #endif 81 #endif /* _HELENOS_SOURCE */ 69 82 70 83 /** @} -
uspace/lib/posix/source/fnmatch.c
r9ba415e re8d3c6f5 49 49 #include "posix/string.h" 50 50 #include "posix/stdlib.h" 51 #include "posix/assert.h"51 #include <assert.h> 52 52 53 53 #include "internal/common.h" -
uspace/lib/posix/source/pwd.c
r9ba415e re8d3c6f5 40 40 #include "posix/string.h" 41 41 #include <errno.h> 42 #include "posix/assert.h"42 #include <assert.h> 43 43 44 44 static bool entry_read = false; -
uspace/lib/posix/source/stdio.c
r9ba415e re8d3c6f5 40 40 #include "posix/stdio.h" 41 41 42 #include "posix/assert.h"42 #include <assert.h> 43 43 44 44 #include <errno.h> -
uspace/lib/posix/source/stdio/scanf.c
r9ba415e re8d3c6f5 36 36 #define __POSIX_DEF__(x) posix_##x 37 37 38 #include "posix/assert.h"38 #include <assert.h> 39 39 40 40 #include <errno.h> -
uspace/lib/posix/source/stdlib/strtold.c
r9ba415e re8d3c6f5 40 40 #include "posix/stdlib.h" 41 41 42 #include "posix/assert.h"42 #include <assert.h> 43 43 #include "posix/ctype.h" 44 44 #include "posix/stdint.h" -
uspace/lib/posix/source/string.c
r9ba415e re8d3c6f5 40 40 #include "posix/string.h" 41 41 42 #include "posix/assert.h"42 #include <assert.h> 43 43 44 44 #include <errno.h> -
uspace/lib/posix/source/sys/wait.c
r9ba415e re8d3c6f5 41 41 42 42 #include "libc/task.h" 43 #include "posix/assert.h"43 #include <assert.h> 44 44 45 45 #include <errno.h> -
uspace/lib/posix/source/time.c
r9ba415e re8d3c6f5 45 45 46 46 #include "posix/signal.h" 47 #include "posix/assert.h"47 #include <assert.h> 48 48 49 49 #include "libc/async.h"
Note:
See TracChangeset
for help on using the changeset viewer.