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 <stdlib.h> |
26 | |
27 | #include "config.h" |
28 | #include "khronos_typedefs.h" |
29 | |
30 | #ifdef HAVE_KHRPLATFORM_H |
31 | |
32 | #include <KHR/khrplatform.h> |
33 | |
34 | #define GET_SIZE(type) sizes[type ## _slot] = sizeof(type) |
35 | |
36 | void |
37 | get_system_typedef_sizes(uint32_t *sizes) |
38 | { |
39 | GET_SIZE(khronos_int8_t); |
40 | GET_SIZE(khronos_uint8_t); |
41 | GET_SIZE(khronos_int16_t); |
42 | GET_SIZE(khronos_uint16_t); |
43 | GET_SIZE(khronos_int32_t); |
44 | GET_SIZE(khronos_uint32_t); |
45 | GET_SIZE(khronos_int64_t); |
46 | GET_SIZE(khronos_uint64_t); |
47 | GET_SIZE(khronos_intptr_t); |
48 | GET_SIZE(khronos_uintptr_t); |
49 | GET_SIZE(khronos_ssize_t); |
50 | GET_SIZE(khronos_usize_t); |
51 | GET_SIZE(khronos_float_t); |
52 | GET_SIZE(khronos_utime_nanoseconds_t); |
53 | GET_SIZE(khronos_stime_nanoseconds_t); |
54 | GET_SIZE(khronos_boolean_enum_t); |
55 | } |
56 | |
57 | #else /* !HAVE_KHRPLATFORM_H */ |
58 | |
59 | /* Don't care -- this is a conditional case in test code. */ |
60 | #pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn" |
61 | |
62 | void |
63 | get_system_typedef_sizes(uint32_t *sizes) |
64 | { |
65 | fputs("./configure failed to find khrplatform.h\n" , stderr); |
66 | exit(77); |
67 | } |
68 | |
69 | #endif |
70 | |