libweston: move TYPEVERIFY macro into shared

This will be useful in the test harness macros.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago committed by Pekka Paalanen
parent 69039ceb43
commit eb5a95bfc9
  1. 7
      libweston/timeline.h
  2. 8
      shared/helpers.h

@ -33,6 +33,8 @@
#include <libweston/weston-log.h> #include <libweston/weston-log.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include "shared/helpers.h"
enum timeline_type { enum timeline_type {
TLT_END = 0, TLT_END = 0,
TLT_OUTPUT, TLT_OUTPUT,
@ -67,11 +69,6 @@ struct weston_timeline_subscription_object {
struct wl_listener destroy_listener; struct wl_listener destroy_listener;
}; };
#define TYPEVERIFY(type, arg) ({ \
typeof(arg) tmp___ = (arg); \
(void)((type)0 == tmp___); \
tmp___; })
/** /**
* Should be used as the last argument when using TL_POINT macro * Should be used as the last argument when using TL_POINT macro
* *

@ -134,6 +134,14 @@ extern "C" {
# endif # endif
#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 #ifdef __cplusplus
} }
#endif #endif

Loading…
Cancel
Save