You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
989 B
C
22 lines
989 B
C
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
#pragma once
|
|
|
|
#define TLSL_TYPES_EQ(TYPE_LHS, TYPE_RHS) ({ \
|
|
_Static_assert(__builtin_types_compatible_p(TYPE_LHS, TYPE_RHS), \
|
|
"types mismatch"); \
|
|
1; \
|
|
})
|
|
|
|
#define TLSL_TYPEOFS_EQ(VAL_LHS, VAL_RHS) TLSL_TYPES_EQ(typeof(VAL_LHS), typeof(VAL_RHS))
|
|
|
|
#define TLSL_CHECK_TYPE(TYPE, VAL) TLSL_TYPES_EQ(TYPE, typeof(VAL))
|
|
|
|
#define TLSL_CHECK_ARRAY(VAL) ({ \
|
|
_Static_assert(!__builtin_types_compatible_p(typeof(VAL), typeof(&(VAL)[0])), \
|
|
"not an array"); \
|
|
1; \
|
|
})
|