From 77d0069e522400b63c2182fcc5f852718e4e6f2c Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sun, 16 Aug 2020 14:11:32 -0400 Subject: rename files that should never be compiled on their own to .h --- src/assert/NDEBUG.c | 14 -------------- src/assert/NDEBUG.h | 14 ++++++++++++++ src/assert/assert.c | 38 -------------------------------------- src/assert/assert.h | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 src/assert/NDEBUG.c create mode 100644 src/assert/NDEBUG.h delete mode 100644 src/assert/assert.c create mode 100644 src/assert/assert.h (limited to 'src/assert') diff --git a/src/assert/NDEBUG.c b/src/assert/NDEBUG.c deleted file mode 100644 index b09e73ce..00000000 --- a/src/assert/NDEBUG.c +++ /dev/null @@ -1,14 +0,0 @@ -/* #undef NDEBUG */ - -#define NDEBUG /** control program diagnostics **/ - -/*** -THIS() is not defined by the compiler or any header. If it is defined -by the programmer before including HEADER(assert.h), it causes -FUNCTION(assert) to be a void statement. Otherwise, FUNCTION(assert) has -its normal behavior. -***/ - -/* -STDC(1) -*/ diff --git a/src/assert/NDEBUG.h b/src/assert/NDEBUG.h new file mode 100644 index 00000000..b09e73ce --- /dev/null +++ b/src/assert/NDEBUG.h @@ -0,0 +1,14 @@ +/* #undef NDEBUG */ + +#define NDEBUG /** control program diagnostics **/ + +/*** +THIS() is not defined by the compiler or any header. If it is defined +by the programmer before including HEADER(assert.h), it causes +FUNCTION(assert) to be a void statement. Otherwise, FUNCTION(assert) has +its normal behavior. +***/ + +/* +STDC(1) +*/ diff --git a/src/assert/assert.c b/src/assert/assert.c deleted file mode 100644 index d49d9800..00000000 --- a/src/assert/assert.c +++ /dev/null @@ -1,38 +0,0 @@ -#undef assert - -#ifdef NDEBUG -# define assert(__exp) ((void)0) -#else -# if __STDC_VERSION__ < 199901L -# define __func__ ((char*)0) -# endif -# define assert(__exp) \ - ((void)((__exp) || \ - (__assert(#__exp, __FILE__, __LINE__, __func__), 0))) -#endif - -/* in c89 - void assert(int expression); */ -/* in c99 - void assert(/scalar/ expression); */ - -/** insert program diagnostics **/ - -/*** -adds mandatory checks to programs. If ARGUMENT(expression) is false, -FUNCTION(assert) prints a diagnostic message to IDENTIFIER(stderr). The -message includes the text of the failed assertion as well as the file name and -line number of the source where the assertion failed. Compilers supporting -std(C99) or higher will also include the name of the function in which the -assertion failed. After printing the diagnostic message, THIS() -causes abnormal program termination by calling FUNCTION(abort). - -If the macro IDENTIFIER(NDEBUG) is defined, THIS() is -defined as DEFINITION(((void)0)). -***/ - -/* -PROTOTYPE(void assert(int expression);) -IMPLEMENTATION(The format of the diagnostic message, TODO: document this here) -UNDEFINED(The THIS() macro is suppressed) -UNDEFINED(ARGUMENT(expression) does not have a scalar type) -STDC(1) -*/ diff --git a/src/assert/assert.h b/src/assert/assert.h new file mode 100644 index 00000000..d49d9800 --- /dev/null +++ b/src/assert/assert.h @@ -0,0 +1,38 @@ +#undef assert + +#ifdef NDEBUG +# define assert(__exp) ((void)0) +#else +# if __STDC_VERSION__ < 199901L +# define __func__ ((char*)0) +# endif +# define assert(__exp) \ + ((void)((__exp) || \ + (__assert(#__exp, __FILE__, __LINE__, __func__), 0))) +#endif + +/* in c89 - void assert(int expression); */ +/* in c99 - void assert(/scalar/ expression); */ + +/** insert program diagnostics **/ + +/*** +adds mandatory checks to programs. If ARGUMENT(expression) is false, +FUNCTION(assert) prints a diagnostic message to IDENTIFIER(stderr). The +message includes the text of the failed assertion as well as the file name and +line number of the source where the assertion failed. Compilers supporting +std(C99) or higher will also include the name of the function in which the +assertion failed. After printing the diagnostic message, THIS() +causes abnormal program termination by calling FUNCTION(abort). + +If the macro IDENTIFIER(NDEBUG) is defined, THIS() is +defined as DEFINITION(((void)0)). +***/ + +/* +PROTOTYPE(void assert(int expression);) +IMPLEMENTATION(The format of the diagnostic message, TODO: document this here) +UNDEFINED(The THIS() macro is suppressed) +UNDEFINED(ARGUMENT(expression) does not have a scalar type) +STDC(1) +*/ -- cgit v1.2.1