1 | /* |
2 | * Copyright © 2014 Intel Corporation |
3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), |
6 | * to deal in the Software without restriction, including without limitation |
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
8 | * and/or sell copies of the Software, and to permit persons to whom the |
9 | * Software is furnished to do so, subject to the following conditions: |
10 | * |
11 | * The above copyright notice and this permission notice (including the next |
12 | * paragraph) shall be included in all copies or substantial portions of the |
13 | * Software. |
14 | * |
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
21 | * IN THE SOFTWARE. |
22 | */ |
23 | |
24 | #include <stdio.h> |
25 | #include "khronos_typedefs.h" |
26 | #include "epoxy/gl.h" |
27 | |
28 | #define COMPARE_SIZE(type) \ |
29 | do { \ |
30 | if (sizeof(type) != system_sizes[type ## _slot]) { \ |
31 | fprintf(stderr, "system %s is size %d, epoxy is %d\n", \ |
32 | #type, \ |
33 | (int)system_sizes[type ## _slot], \ |
34 | (int)sizeof(type)); \ |
35 | error = true; \ |
36 | } \ |
37 | } while (0) |
38 | |
39 | int |
40 | main(int argc, char **argv) |
41 | { |
42 | uint32_t system_sizes[khronos_typedef_count]; |
43 | bool error = false; |
44 | |
45 | get_system_typedef_sizes(sizes: system_sizes); |
46 | |
47 | COMPARE_SIZE(khronos_int8_t); |
48 | COMPARE_SIZE(khronos_uint8_t); |
49 | COMPARE_SIZE(khronos_int16_t); |
50 | COMPARE_SIZE(khronos_uint16_t); |
51 | COMPARE_SIZE(khronos_int32_t); |
52 | COMPARE_SIZE(khronos_uint32_t); |
53 | COMPARE_SIZE(khronos_int64_t); |
54 | COMPARE_SIZE(khronos_uint64_t); |
55 | COMPARE_SIZE(khronos_intptr_t); |
56 | COMPARE_SIZE(khronos_uintptr_t); |
57 | COMPARE_SIZE(khronos_ssize_t); |
58 | COMPARE_SIZE(khronos_usize_t); |
59 | COMPARE_SIZE(khronos_float_t); |
60 | COMPARE_SIZE(khronos_utime_nanoseconds_t); |
61 | COMPARE_SIZE(khronos_stime_nanoseconds_t); |
62 | COMPARE_SIZE(khronos_boolean_enum_t); |
63 | |
64 | return error; |
65 | } |
66 | |