k_debug.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
28 #ifndef DEBUG_H
29 #define DEBUG_H
30 
31 #include <stdio.h>
32 #include <csp/csp_debug.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
49 #if ENABLE_DEBUG
50 
51 #define DEBUG_PRINT(...) printf(__VA_ARGS__);
52 
59 # if defined(__cplusplus) && defined(__GNUC__)
60 # define DEBUG_FUNC __PRETTY_FUNCTION__
61 # elif __STDC_VERSION__ >= 199901L
62 # define DEBUG_FUNC __func__
63 # elif __GNUC__ >= 2
64 # define DEBUG_FUNC __FUNCTION__
65 # else
66 # define DEBUG_FUNC ""
67 # endif
68 
76 #define DEBUG(...) DEBUG_PRINT(__VA_ARGS__)
77 #else
78 #define DEBUG(...)
79 #endif
80 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif /* DEBUG_H */
88