X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fcommon%2Ffirm_common.c;h=6922cefca7b899a7dff592f928d53966c37146ad;hb=f710ccc214eac12711b686ce8878c2e48a52fc70;hp=ef3e6eed899db4b1387f47288bb86d5495643488;hpb=a30e04ba46be95dab4cdf4fe058f4106dd6ac592;p=libfirm diff --git a/ir/common/firm_common.c b/ir/common/firm_common.c index ef3e6eed8..6922cefca 100644 --- a/ir/common/firm_common.c +++ b/ir/common/firm_common.c @@ -19,11 +19,16 @@ #include "irgraph.h" #include "irloop.h" +/** + * Ideally, this macro would check if size bytes could be read at + * pointer p. No generic solution. + */ +#define POINTER_READ(p, size) (p) + /* returns the kind of the thing */ firm_kind get_kind (const void *firm_thing) { - assert (firm_thing); - return *(firm_kind *)firm_thing; + return POINTER_READ(firm_thing, sizeof(firm_kind)) ? *(firm_kind *)firm_thing : k_BAD; }