Astaroth  2.2
errchk.h File Reference

Brief info. More...

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+ Include dependency graph for errchk.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ERROR(str)
 
#define WARNING(str)
 
#define ERRCHK(retval)
 
#define WARNCHK(retval)
 
#define WARNCHK_ALWAYS(retval)
 
#define ERRCHK_ALWAYS(retval)
 

Detailed Description

Brief info.

Detailed info.

Macro Definition Documentation

◆ ERRCHK

#define ERRCHK (   retval)
Value:
{ \
if (!(retval)) \
ERROR(#retval " was false"); \
}

◆ ERRCHK_ALWAYS

#define ERRCHK_ALWAYS (   retval)
Value:
{ \
if (!(retval)) \
ERROR(#retval " was false"); \
}

◆ ERROR

#define ERROR (   str)
Value:
{ \
time_t t; \
time(&t); \
fprintf(stderr, "%s", ctime(&t)); \
fprintf(stderr, "\tError in file %s line %d: %s\n", __FILE__, __LINE__, str); \
fflush(stderr); \
exit(EXIT_FAILURE); \
abort(); \
}

◆ WARNCHK

#define WARNCHK (   retval)
Value:
{ \
if (!(retval)) \
WARNING(#retval " was false"); \
}

◆ WARNCHK_ALWAYS

#define WARNCHK_ALWAYS (   retval)
Value:
{ \
if (!(retval)) \
WARNING(#retval " was false"); \
}

◆ WARNING

#define WARNING (   str)
Value:
{ \
time_t t; \
time(&t); \
fprintf(stderr, "%s", ctime(&t)); \
fprintf(stderr, "\tWarning in file %s line %d: %s\n", __FILE__, __LINE__, str); \
fflush(stderr); \
}