diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-04 12:02:56 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-04 12:02:56 +0200 |
| commit | e6be287bbfa6beda038ec8b085300c5dc9c2ecd8 (patch) | |
| tree | 55d0acb9efde811985157068f3656514b90344cf /src/utils | |
| parent | 2ac46cb4d4133e5d5de90bacfc9b6e979d1d6046 (diff) | |
| download | nissy-core-e6be287bbfa6beda038ec8b085300c5dc9c2ecd8.tar.gz nissy-core-e6be287bbfa6beda038ec8b085300c5dc9c2ecd8.zip | |
Use macro for [static N]
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/compilers.h | 17 | ||||
| -rw-r--r-- | src/utils/wrapthread.h | 4 |
2 files changed, 16 insertions, 5 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 | /* |
| 16 | For example MSVC, which is not fully C11 compliant (e.g. it does not support | ||
| 17 | a[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/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 | ||
