-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7385ba3
commit 887ed60
Showing
9 changed files
with
95 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# C standard library and C++ abi. | ||
add_platform_library(common-c | ||
# assert.h | ||
assert.c | ||
|
||
# ctype.h | ||
ctype.c | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <assert.h> | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
void __assert(const char *file, const char *line, const char *function, | ||
const char *expr) { | ||
fputs(file, stderr); | ||
fputc(':', stderr); | ||
fputs(line, stderr); | ||
fputs(": ", stderr); | ||
fputs(function, stderr); | ||
fputs(": assertion failed: ", stderr); | ||
fputs(expr, stderr); | ||
fputc('\n', stderr); | ||
abort(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef __INTERNAL_H_ | ||
#define __INTERNAL_H_ | ||
|
||
// Originally from the Public Domain C Library (PDCLib). | ||
|
||
#define _SYMBOL_TO_STRING(x) #x | ||
#define _VALUE_TO_STRING(x) _SYMBOL_TO_STRING(x) | ||
|
||
#endif // not __INTERNAL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Originally from the Public Domain C library (PDCLib). | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <__internal.h> | ||
|
||
#ifndef _ASSERT_H | ||
#define _ASSERT_H | ||
void __assert(const char *file, const char *line, const char *function, | ||
const char *expr); | ||
#endif | ||
|
||
/* If NDEBUG is set, assert() is a null operation. */ | ||
#undef assert | ||
|
||
#ifdef NDEBUG | ||
#define assert(ignore) ((void)0) | ||
#else | ||
// Breaking this apart by component saves space. | ||
#define assert(expression) \ | ||
((expression) ? (void)0 \ | ||
: __assert(__FILE__, _VALUE_TO_STRING(__LINE__), __func__, \ | ||
#expression)) | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.