File: debug.hpp

package info (click to toggle)
golang-github-wellington-go-libsass 0.9.2%2Bgit20181130.4ef5b9d-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,128 kB
  • sloc: cpp: 28,607; ansic: 839; makefile: 44
file content (43 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (14)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef SASS_DEBUG_H
#define SASS_DEBUG_H

#include <stdint.h>

#ifndef UINT32_MAX
  #define UINT32_MAX 0xffffffffU
#endif

enum dbg_lvl_t : uint32_t {
  NONE = 0,
  TRIM = 1,
  CHUNKS = 2,
  SUBWEAVE = 4,
  WEAVE = 8,
  EXTEND_COMPOUND = 16,
  EXTEND_COMPLEX = 32,
  LCS = 64,
  EXTEND_OBJECT = 128,
  ALL = UINT32_MAX
};

#ifdef DEBUG

#ifndef DEBUG_LVL
const uint32_t debug_lvl = UINT32_MAX;
#else
const uint32_t debug_lvl = (DEBUG_LVL);
#endif // DEBUG_LVL

#define DEBUG_PRINT(lvl, x) if((lvl) & debug_lvl) { std::cerr << x; }
#define DEBUG_PRINTLN(lvl, x) if((lvl) & debug_lvl) { std::cerr << x << std::endl; }
#define DEBUG_EXEC(lvl, x) if((lvl) & debug_lvl) { x; }

#else // DEBUG

#define DEBUG_PRINT(lvl, x)
#define DEBUG_PRINTLN(lvl, x)
#define DEBUG_EXEC(lvl, x)

#endif // DEBUG

#endif // SASS_DEBUG