Ponca
a8a21c362dc2c650634ff9a07307bf4e308b2e74
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 \
7
do \
8
{
9
#define PONCA_MACRO_END \
10
} \
11
while (0)
12
13
// Stringification
14
#define PONCA_XSTR(S) #S
15
#define PONCA_STR(S) PONCA_XSTR(S)
16
17
#ifdef __CUDA_ARCH__
18
# define PONCA_ABORT asm("trap;");
19
#elif defined(_MSC_VER)
20
# define PONCA_ABORT __debugbreak();
21
#elif defined(__clang__) || defined(__GNUC__)
22
# define PONCA_ABORT __builtin_trap();
23
#else
24
# include <cstdlib>
25
# define PONCA_ABORT std::abort();
26
#endif
27
28
#define PONCA_CRASH \
29
PONCA_MACRO_START \
30
PONCA_ABORT \
31
PONCA_MACRO_END
32
33
#ifdef __CUDA_ARCH__
34
# define PONCA_PRINT_ERROR(MSG) \
35
PONCA_MACRO_START \
36
printf("%s:%i: [Error] %s\n", __FILE__, __LINE__, MSG); \
37
PONCA_MACRO_END
38
# define PONCA_PRINT_WARNING(MSG) \
39
PONCA_MACRO_START \
40
printf("%s:%i: [Warning] %s\n", __FILE__, __LINE__, MSG); \
41
PONCA_MACRO_END
42
#else
43
# define PONCA_PRINT_ERROR(MSG) \
44
PONCA_MACRO_START \
45
fprintf(stderr, "%s:%i: [Error] %s\n", __FILE__, __LINE__, MSG); \
46
fflush(stderr); \
47
PONCA_MACRO_END
48
# define PONCA_PRINT_WARNING(MSG) \
49
PONCA_MACRO_START \
50
fprintf(stderr, "%s:%i: [Warning] %s\n", __FILE__, __LINE__, MSG); \
51
fflush(stderr); \
52
PONCA_MACRO_END
53
#endif
54
55
// turnoff warning
56
#define PONCA_UNUSED(VAR) \
57
PONCA_MACRO_START(void)(VAR); \
58
PONCA_MACRO_END
59
60
#define PONCA_TODO \
61
PONCA_MACRO_START \
62
PONCA_PRINT_ERROR("TODO"); \
63
PONCA_CRASH; \
64
PONCA_MACRO_END
65
66
#ifdef __has_builtin
67
# if __has_builtin(__builtin_clz)
68
# define PONCA_HAS_BUILTIN_CLZ 1
69
# endif
70
#endif
71
72
#ifndef PONCA_HAS_BUILTIN_CLZ
73
# define PONCA_HAS_BUILTIN_CLZ 0
74
#endif
src
Ponca
src
Common
Macro.h
Generated on Fri Apr 24 2026 15:55:19 for Ponca by
1.9.8