Commit | Line | Data |
---|---|---|
7515f897 JB |
1 | /* |
2 | * ===================================================================================== | |
3 | * | |
4 | * Filename: macros.h | |
5 | * | |
6 | * Description: Some useful macros | |
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 | #include <stdlib.h> | |
23 | ||
24 | /* definition to expand macro then apply to pragma message */ | |
25 | #define VALUE_TO_STRING(x) #x | |
26 | #define VALUE(x) VALUE_TO_STRING(x) | |
27 | #define VAR_NAME_VALUE(var) #var "=" VALUE(var) | |
28 | ||
29 | /* FIXME: ensure we manipulate real array */ | |
30 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) | |
31 | ||
811d4abe | 32 | #endif /* MACROS_H */ |