cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
_ccl_defs.h
Go to the documentation of this file.
1 /*
2  * This file is part of cf4ocl (C Framework for OpenCL).
3  *
4  * cf4ocl is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * cf4ocl is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with cf4ocl. If not, see
16  * <http://www.gnu.org/licenses/>.
17  * */
18 
30 #ifndef _CCL_DEFS_H_
31 #define _CCL_DEFS_H_
32 
33 /* These deprecation macros are copied from GLib latest version in
34  * order to support Clang. */
35 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
36 #define CCL_BEGIN_IGNORE_DEPRECATIONS \
37  _Pragma ("GCC diagnostic push") \
38  _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
39 #define CCL_END_IGNORE_DEPRECATIONS \
40  _Pragma ("GCC diagnostic pop")
41 #elif defined (_MSC_VER) && (_MSC_VER >= 1500)
42 #define CCL_BEGIN_IGNORE_DEPRECATIONS \
43  __pragma (warning (push)) \
44  __pragma (warning (disable : 4996))
45 #define CCL_END_IGNORE_DEPRECATIONS \
46  __pragma (warning (pop))
47 #elif defined (__clang__)
48 #define CCL_BEGIN_IGNORE_DEPRECATIONS \
49  _Pragma("clang diagnostic push") \
50  _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
51 #define CCL_END_IGNORE_DEPRECATIONS \
52  _Pragma("clang diagnostic pop")
53 #else
54 #define CCL_BEGIN_IGNORE_DEPRECATIONS
55 #define CCL_END_IGNORE_DEPRECATIONS
56 #endif
57 
64 #ifndef g_info
65 #define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__)
66 #endif
67 
68 /* Macro which determines part of the information which appears in debug log
69  * messages. */
70 #ifndef CCL_STRD
71  #ifdef NDEBUG
72  #define CCL_STRD G_STRFUNC
73  #else
74  #define CCL_STRD G_STRLOC
75  #endif
76 #endif
77 
91 #define ccl_if_err_create_goto( \
92  err, quark, error_condition, error_code, label, msg, ...) \
93  if (error_condition) { \
94  g_set_error(&(err), (quark), (error_code), (msg), ##__VA_ARGS__); \
95  g_debug(CCL_STRD); \
96  goto label; \
97  }
98 
106 #define ccl_if_err_goto(err, label) \
107  if ((err) != NULL) { \
108  g_debug(CCL_STRD); \
109  goto label; \
110  }
111 
120 #define ccl_if_err_propagate_goto(err_dest, err_src, label) \
121  if ((err_src) != NULL) { \
122  g_debug(CCL_STRD); \
123  g_propagate_error(err_dest, err_src); \
124  err_src = NULL; \
125  goto label; \
126  }
127 
128 #endif /* _CCL_DEFS_H_ */