summaryrefslogtreecommitdiffstats
path: root/include/c/qual/type/type.h
blob: bfbb9b3cce2044483079bef1c6ff0ef1c9ac33d5 (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
// Copyright 2022 Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier:  LGPL-3.0-or-later WITH LGPL-3.0-linking-exception


#ifndef INCLUDE_C_QUAL_TYPE_TYPE_H_
#define INCLUDE_C_QUAL_TYPE_TYPE_H_


#include <stdbool.h>


#if !defined(auto)
# define auto  __auto_type
#endif


#define c_reinterpret_cast(t, e)  ((t) (e))


#define c_voidify_p(p)                                                        \
({                                                                            \
	auto  p_ = (p);                                                       \
                                                                              \
	true ? p_ : c_reinterpret_cast(void *, p_);                           \
})


#define c_is_same_type(a, b)  __builtin_types_compatible_p(typeof(a), typeof(b))


#endif  // Header guard