Ponca  aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
Loading...
Searching...
No Matches
Macro.h
1#pragma once
2
3#include <cstdio>
4
5// macro delimiters
6#define PONCA_MACRO_START do {
7#define PONCA_MACRO_END } while(0)
8
9// Stringification
10#define PONCA_XSTR(S) #S
11#define PONCA_STR(S) PONCA_XSTR(S)
12
13#define PONCA_CRASH \
14 PONCA_MACRO_START \
15 asm volatile ("int $3"); \
16 PONCA_MACRO_END
17
18#define PONCA_PRINT_ERROR(MSG) \
19 PONCA_MACRO_START \
20 fprintf(stderr, \
21 "%s:%i: [Error] %s\n", \
22 __FILE__,__LINE__,MSG); \
23 fflush(stderr); \
24 PONCA_MACRO_END
25
26#define PONCA_PRINT_WARNING(MSG) \
27 PONCA_MACRO_START \
28 fprintf(stderr, \
29 "%s:%i: [Warning] %s\n", \
30 __FILE__,__LINE__,MSG); \
31 fflush(stderr); \
32 PONCA_MACRO_END
33
34// turnoff warning
35#define PONCA_UNUSED(VAR) \
36 PONCA_MACRO_START \
37 (void)(VAR); \
38 PONCA_MACRO_END
39
40#define PONCA_TODO \
41 PONCA_MACRO_START \
42 PONCA_PRINT_ERROR("TODO"); \
43 PONCA_CRASH; \
44 PONCA_MACRO_END
45
46#ifdef __has_builtin
47#if __has_builtin(__builtin_clz)
48#define PONCA_HAS_BUILTIN_CLZ 1
49#endif
50#endif
51
52#ifndef PONCA_HAS_BUILTIN_CLZ
53#define PONCA_HAS_BUILTIN_CLZ 0
54#endif