libweston: move TYPEVERIFY macro into shared

This will be useful in the test harness macros.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen
2021-02-15 13:34:01 +02:00
committed by Pekka Paalanen
parent 69039ceb43
commit eb5a95bfc9
2 changed files with 10 additions and 5 deletions
+8
View File
@@ -134,6 +134,14 @@ extern "C" {
# endif
#endif
/** Ensure argument is of given type */
#ifndef TYPEVERIFY
#define TYPEVERIFY(type, arg) ({ \
typeof(arg) tmp___ = (arg); \
(void)((type)0 == tmp___); \
tmp___; })
#endif
#ifdef __cplusplus
}
#endif