diff --git a/ORCACDefs/assert.h b/ORCACDefs/assert.h index 7c04dbc..7622586 100644 --- a/ORCACDefs/assert.h +++ b/ORCACDefs/assert.h @@ -15,15 +15,20 @@ #endif #ifndef NDEBUG -#define assert(expression) (expression) ? ((void) 0) : (__assert(__FILE__, __LINE__, #expression)) +#ifndef __GNO__ +#define assert(expression) (expression) ? ((void) 0) : (__assert2(__FILE__, __LINE__, __func__, #expression)) #else -#define assert(expression) ((void) 0) +#define assert(expression) (expression) ? ((void) 0) : (__assert(__FILE__, __LINE__, #expression)) +#endif +#else +#define assert(expression) ((void)0) #endif #ifndef __assert__ #define __assert__ -extern void __assert(char *, int, char *); +extern void __assert(const char *, unsigned, const char *); +extern void __assert2(const char *, unsigned, const char *, const char *); #define static_assert _Static_assert diff --git a/cc.notes b/cc.notes index 45e9159..a9d285e 100644 --- a/cc.notes +++ b/cc.notes @@ -244,9 +244,9 @@ p. 343 The documentation states that assert() uses exit(-1) to exit a program. Actually, it uses abort(). -Beginning with ORCA/C 2.1, assert() prints a string that includes the assertion itself, not just the line number and file name. The assertion has the form +Beginning with ORCA/C 2.1, assert() prints a string that includes the assertion itself, not just the line number and file name. Beginning with ORCA/C 2.2.0 B5, it also includes the name of the enclosing function. The assertion has the form - Assertion failed: file :hd:foo.cc, line 47; assertion: bar==1 + Assertion failed: file :hd:foo.cc, line 47, function fn; assertion: bar==1 The documentation states assert() writes to stdout. Beginning with ORCA/C 2.1, it writes to stderr.