Commit | Line | Data |
---|---|---|
fac749d5 JB |
1 | /* |
2 | * ===================================================================================== | |
3 | * | |
4 | * Filename: macros.h | |
5 | * | |
6 | * Description: | |
7 | * | |
8 | * Version: 1.0 | |
9 | * Created: 09/03/2017 15:28:46 | |
10 | * Revision: none | |
11 | * Compiler: gcc | |
12 | * | |
13 | * Author: Jerome Benoit (fraggle), jerome.benoit@piment-noir.org | |
14 | * Organization: Piment Noir | |
15 | * | |
16 | * ===================================================================================== | |
17 | */ | |
18 | ||
19 | #ifndef MACROS_H | |
20 | #define MACROS_H | |
21 | ||
22 | /* definition to expand macro then apply to pragma message */ | |
23 | #define VALUE_TO_STRING(x) #x | |
24 | #define VALUE(x) VALUE_TO_STRING(x) | |
25 | #define VAR_NAME_VALUE(var) #var "=" VALUE(var) | |
26 | ||
27 | #define ARRAY_SIZE(arr) ({typeof (arr) arr ## _is_a_pointer __attribute__((unused)) = {}; \ | |
28 | sizeof(arr) / sizeof(arr[0]);}) | |
29 | ||
30 | #endif /* MACROS_H */ |