diff options
author | rms <rms@138bc75d-0d04-0410-961f-82ee72b054a4> | 1992-01-04 08:17:14 +0000 |
---|---|---|
committer | rms <rms@138bc75d-0d04-0410-961f-82ee72b054a4> | 1992-01-04 08:17:14 +0000 |
commit | 42b2eae5626e1acb91f7a13fc973f92be2ea6e7d (patch) | |
tree | 78301e6422ac48bdb177dffc3e44372f6d0c1e13 /gcc/assert.h | |
parent | 22efcdcd023d04a8ea9513de85286304354d9f31 (diff) | |
download | gcc-42b2eae5626e1acb91f7a13fc973f92be2ea6e7d.tar.gz |
Initial revision
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/assert.h')
-rw-r--r-- | gcc/assert.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/assert.h b/gcc/assert.h new file mode 100644 index 00000000000..7d1c5f89faa --- /dev/null +++ b/gcc/assert.h @@ -0,0 +1,42 @@ +/* Allow this file to be included multiple times + with different settings of NDEBUG. */ +#undef assert +#undef __assert + +#ifdef NDEBUG +#define assert(ignore) ((void) 0) +#else + +#ifndef __GNUC__ + +#define assert(expression) \ + ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__))) + +#define __assert(expression, file, lineno) \ + (printf ("%s:%d: failed assertion\n", file, lineno), \ + abort (), 0) + +#else +void __eprintf (); /* Defined in libgcc.a */ + +#ifdef __STDC__ + +#define assert(expression) \ + ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__))) + +#define __assert(expression, file, line) \ + (__eprintf ("%s:%d: failed assertion `%s'\n", \ + file, line, expression), 0) + +#else /* no __STDC__; i.e. -traditional. */ + +#define assert(expression) \ + ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__))) + +#define __assert(expression, file, lineno) \ + (__eprintf ("%s:%d: failed assertion `%s'\n", \ + file, lineno, "expression"), 0) + +#endif /* no __STDC__; i.e. -traditional. */ +#endif /* no __GNU__; i.e., /bin/cc. */ +#endif |