Mercury
mercury_util_error.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Argonne National Laboratory, Department of Energy,
3  *                    UChicago Argonne, LLC and The HDF Group.
4  * All rights reserved.
5  *
6  * The full copyright notice, including terms governing use, modification,
7  * and redistribution, is contained in the COPYING file that can be
8  * found at the root of the source code distribution tree.
9  */
10 
11 #ifndef MERCURY_UTIL_ERROR_H
12 #define MERCURY_UTIL_ERROR_H
13 
14 #include "mercury_util_config.h"
15 
16 /* For compatibility */
17 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 199901L)
18  #if defined(__GNUC__) && (__GNUC__ >= 2)
19  #define __func__ __FUNCTION__
20  #else
21  #define __func__ "<unknown>"
22  #endif
23 #elif defined(_WIN32)
24  #define __func__ __FUNCTION__
25 #endif
26 
27 /* Default error macro */
28 #ifdef HG_UTIL_HAS_VERBOSE_ERROR
29  #include <stdio.h>
30  #define HG_UTIL_ERROR_DEFAULT(x) { \
31  fprintf(stderr, "Error " \
32  "in %s:%d (%s): " \
33  "%s.\n", \
34  __FILE__, __LINE__, __func__, x); \
35  }
36 #else
37  #define HG_UTIL_ERROR_DEFAULT(x)
38 #endif
39 
40 #endif /* MERCURY_UTIL_ERROR_H */