aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/check_config_h.py
blob: 0fe56908df571d40d3694cf565d80815ccec4ff5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import sys

data = """
#if defined(SIZEOF_LONG)
static_assert(sizeof(long) == SIZEOF_LONG, "fixme 1");
#endif

#if defined(SIZEOF_PTHREAD_T)
#include <pthread.h>

static_assert(sizeof(pthread_t) == SIZEOF_PTHREAD_T, "fixme 2");
#endif

#if defined(SIZEOF_SIZE_T)
#include <stddef.h>

static_assert(sizeof(size_t) == SIZEOF_SIZE_T, "fixme 3");
#endif

#if defined(SIZEOF_TIME_T)
#include <time.h>

static_assert(sizeof(time_t) == SIZEOF_TIME_T, "fixme 4");
#endif

#if defined(SIZEOF_UINTPTR_T)
#include <stdint.h>

static_assert(sizeof(uintptr_t) == SIZEOF_UINTPTR_T, "fixme 5");
#endif

#if defined(SIZEOF_VOID_P)
static_assert(sizeof(void*) == SIZEOF_VOID_P, "fixme 6");
#endif

#if defined(SIZEOF_FPOS_T)
#include <stdio.h>

static_assert(sizeof(fpos_t) == SIZEOF_FPOS_T, "fixme 7");
#endif

#if defined(SIZEOF_DOUBLE)
static_assert(sizeof(double) == SIZEOF_DOUBLE, "fixme 8");
#endif

#if defined(SIZEOF_LONG_DOUBLE)
static_assert(sizeof(long double) == SIZEOF_LONG_DOUBLE, "fixme 9");
#endif

#if defined(SIZEOF_FLOAT)
static_assert(sizeof(float) == SIZEOF_FLOAT, "fixme 10");
#endif

#if defined(SIZEOF_INT)
static_assert(sizeof(int) == SIZEOF_INT, "fixme 11");
#endif

#if defined(SIZEOF_LONG_LONG)
static_assert(sizeof(long long) == SIZEOF_LONG_LONG, "fixme 12");
#endif

#if defined(SIZEOF_OFF_T)
#include <stdio.h>

static_assert(sizeof(off_t) == SIZEOF_OFF_T, "fixme 13");
#endif

#if defined(SIZEOF_PID_T)
#include <unistd.h>

static_assert(sizeof(pid_t) == SIZEOF_PID_T, "fixme 14");
#endif

#if defined(SIZEOF_SHORT)
static_assert(sizeof(short) == SIZEOF_SHORT, "fixme 15");
#endif

#if defined(SIZEOF_WCHAR_T)
static_assert(sizeof(wchar_t) == SIZEOF_WCHAR_T, "fixme 16");
#endif

#if defined(SIZEOF__BOOL)
//TODO
#endif
"""
if __name__ == '__main__': 
    with open(sys.argv[2], 'w') as f: 
        f.write('#include <' + sys.argv[1] + '>\n\n') 
        f.write(data)