Go to the documentation of this file.
11 #ifndef MERCURY_ERROR_H
12 #define MERCURY_ERROR_H
14 #include "mercury_config.h"
17 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 199901L)
18 #if defined(__GNUC__) && (__GNUC__ >= 2)
19 #define __func__ __FUNCTION__
21 #define __func__ "<unknown>"
24 #define __func__ __FUNCTION__
28 #ifdef HG_HAS_VERBOSE_ERROR
30 #define HG_LOG_ERROR(...) do { \
31 fprintf(stderr, "HG: Error in %s:%d\n", __FILE__, __LINE__); \
32 fprintf(stderr, " # %s(): ", __func__); \
33 fprintf(stderr, __VA_ARGS__); \
34 fprintf(stderr, "\n"); \
36 #define HG_LOG_DEBUG(...) do { \
37 fprintf(stdout, "HG: in %s:%d\n", __FILE__, __LINE__); \
38 fprintf(stdout, " # %s(): ", __func__); \
39 fprintf(stdout, __VA_ARGS__); \
40 fprintf(stdout, "\n"); \
42 #define HG_LOG_WARNING(...) do { \
43 fprintf(stdout, "HG: Warning in %s:%d\n", __FILE__, __LINE__); \
44 fprintf(stdout, " # %s(): ", __func__); \
45 fprintf(stdout, __VA_ARGS__); \
46 fprintf(stdout, "\n"); \
51 #define HG_LOG_WARNING
55 #define HG_ERROR_DEFAULT HG_LOG_ERROR
56 #define HG_WARNING_DEFAULT HG_LOG_DEBUG