-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.h
More file actions
25 lines (22 loc) · 1.17 KB
/
debug.h
File metadata and controls
25 lines (22 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include <stdio.h>
#ifdef DEBUG
#define debug(...) \
do { \
fprintf(stderr, "[%s:%s():%d]\t", __FILE__, __func__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} while (0);
#else
#define debug(...) ((void) 0)
#endif
#ifdef DEBUG
#define fdebug(stream, ...) \
do { \
fprintf(stream, "[%s:%s():%d]\t", __FILE__, __func__, __LINE__); \
fprintf(stream, __VA_ARGS__); \
fprintf(stream, "\n"); \
} while (0);
#else
#define fdebug(stream, ...) ((void) 0)
#endif