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/compilers.h | |
| parent | 2ac46cb4d4133e5d5de90bacfc9b6e979d1d6046 (diff) | |
| download | nissy-core-e6be287bbfa6beda038ec8b085300c5dc9c2ecd8.tar.gz nissy-core-e6be287bbfa6beda038ec8b085300c5dc9c2ecd8.zip | |
Use macro for [static N]
Diffstat (limited to 'src/utils/compilers.h')
| -rw-r--r-- | src/utils/compilers.h | 17 |
1 files changed, 14 insertions, 3 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 |
