aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/compilers.h17
-rw-r--r--src/utils/dbg_log.h3
-rw-r--r--src/utils/math.h6
-rw-r--r--src/utils/wrapthread.h4
4 files changed, 20 insertions, 10 deletions
diff --git a/src/utils/compilers.h b/src/utils/compilers.h
index a7d6df5..1b175bb 100644
--- a/src/utils/compilers.h
+++ b/src/utils/compilers.h
@@ -1,13 +1,24 @@
1#if defined(__GNUC__) 1#if defined(__GNUC__)
2 2
3#define unused __attribute__((unused)) 3#define UNUSED __attribute__((unused))
4#define SIZE(x) static (x)
5#define NON_NULL SIZE(1)
4 6
5#elif defined(__clang__) 7#elif defined(__clang__)
6 8
7#define unused __attribute__((unused)) 9#define UNUSED __attribute__((unused))
10#define SIZE(x) static (x)
11#define NON_NULL SIZE(1)
8 12
9#else 13#else
10 14
11#define unused 15/*
16For example MSVC, which is not fully C11 compliant (e.g. it does not support
17a[static N] notation for array parameters).
18*/
19
20#define UNUSED
21#define SIZE(x)
22#define NON_NULL
12 23
13#endif 24#endif
diff --git a/src/utils/dbg_log.h b/src/utils/dbg_log.h
index d737ff2..08d42a3 100644
--- a/src/utils/dbg_log.h
+++ b/src/utils/dbg_log.h
@@ -7,8 +7,7 @@ void write_wrapper(void (*)(const char *, void *), const char *, ...);
7void 7void
8write_wrapper(void (*write)(const char *, void *), const char *str, ...) 8write_wrapper(void (*write)(const char *, void *), const char *str, ...)
9{ 9{
10 static const size_t len = 1000; 10 char message[1000];
11 char message[len];
12 va_list args; 11 va_list args;
13 12
14 va_start(args, str); 13 va_start(args, str);
diff --git a/src/utils/math.h b/src/utils/math.h
index f2176b6..0c56861 100644
--- a/src/utils/math.h
+++ b/src/utils/math.h
@@ -73,10 +73,10 @@ indextoperm(uint64_t p, size_t n, uint8_t *r)
73 73
74 /* Find k-th unused number */ 74 /* Find k-th unused number */
75 for (j = 0, c = 0; c <= k; j++) 75 for (j = 0, c = 0; c <= k; j++)
76 c += 1 - ((used & (1<<j)) >> j); 76 c += UINT64_C(1) - ((used & (UINT64_C(1)<<j)) >> j);
77 77
78 r[i] = j-1; 78 r[i] = (uint8_t)(j-1);
79 used |= 1 << (j-1); 79 used |= UINT64_C(1) << (j-1);
80 p %= factorial[n-i-1]; 80 p %= factorial[n-i-1];
81 } 81 }
82 82
diff --git a/src/utils/wrapthread.h b/src/utils/wrapthread.h
index 4ac72a6..9578293 100644
--- a/src/utils/wrapthread.h
+++ b/src/utils/wrapthread.h
@@ -61,8 +61,8 @@
61 #define wrapthread_return_t int 61 #define wrapthread_return_t int
62 #define wrapthread_return_val 0 62 #define wrapthread_return_val 0
63 63
64 #define wrapthread_define_var_thread_t(x) unused char x 64 #define wrapthread_define_var_thread_t(x) UNUSED char x
65 #define wrapthread_define_var_mutex_t(x) unused char x 65 #define wrapthread_define_var_mutex_t(x) UNUSED char x
66 #define wrapthread_define_struct_thread_t(x) char x 66 #define wrapthread_define_struct_thread_t(x) char x
67 #define wrapthread_define_struct_mutex_t(x) char x 67 #define wrapthread_define_struct_mutex_t(x) char x
68 68

Generated with cgit - Back to sebastiano.tronto.net